Skip to content

test(cursor_tracking): scroll for real instead of reading a stale w$ after winrestview - #565

Merged
jensenojs merged 1 commit into
sudo-tee:mainfrom
jensenojs:test/wrapped-visible-bottom
Nov 11, 2026
Merged

jensenojs merged 1 commit into
sudo-tee:mainfrom
jensenojs:test/wrapped-visible-bottom

Conversation

@jensenojs

Copy link
Copy Markdown
Collaborator

Problem

The nightly CI job fails on `output_window.is_at_bottom reports the actual visible bottom line in wrapped windows` (also reproduces on unmodified `main` locally with `NVIM v0.13.0-dev-2081`).

The test restores `topline=1` with `winrestview()` and immediately reads `line('w$', win)` without a redraw. Since neovim/neovim#37047 (commit 033f112, "fix(marks): wrong line('w$', win) with conceal_lines"), `line('w$', win)` validates the target window directly instead of switching curwin first. One side effect is that right after `winrestview` — before any redraw — the read returns the pre-restore viewport's bottom line (5) instead of a value reflecting the restored topline (2), so `assert(visible_bottom < 5)` fails.

The real rendered viewport is unchanged between versions; only the freshness of this particular stale read differs (verified with a headless probe: after `redraw` or a real scroll, 0.12.6 and nightly agree exactly).

Change

Scroll with `normal! gg` inside `nvim_win_call` instead of poking the view with `winrestview` and relying on unspecified stale-read behavior. The assertion target is unchanged: with `topline=1`, height 10, `wrap`, width 20, the long line wraps to 9 rows and is cut off, so the last completely visible line is 2, never the last buffer line (5).

Verification

  • `tests/unit/cursor_tracking_spec.lua` passes on nvim 0.12.6 and nightly `v0.13.0-dev-2081`.
  • Full `make test` on nightly: unit 30/30, replay 54/54.

…after winrestview

The wrapped-window is_at_bottom test restored topline=1 via winrestview
and immediately read line('w$', win) without a redraw. Since neovim#37047
(commit 033f112) line('w$', win) validates the target window without
switching curwin, so on nightly the read returns the pre-restore viewport's
bottom line and the assertion fails. Scrolling with normal! gg settles the
viewport on every version: verified the spec passes on nvim 0.12.6 and
nightly (v0.13.0-dev-2081).
@jensenojs
jensenojs merged commit 96c610b into sudo-tee:main Nov 11, 2026
8 checks passed
@jensenojs
jensenojs deleted the test/wrapped-visible-bottom branch November 11, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant