Repository navigation
test(cursor_tracking): scroll for real instead of reading a stale w$ after winrestview - #565
Merged
Conversation
…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).
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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