You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If e.g. 1) the first line in the window is wrapped, 2) the cursor is on any line below that, and 3) * would cause the view to move down (i.e. the next match is not yet visible), then winline() - s:winline will usually compute an incorrect sdiff, and we will <C-y> more times than necessary, shifting the view up by at least 1 line (unless we were already at the beginning of the buffer, or there are some other edge cases).
Possible solution
I believe using winsaveview()['topline'] instead of winline() avoids this discrepancy between buffer lines and screen lines.
I'll put up a PR with that approach, but 1) I'm not sure if there's a simpler way to get topline (maybe some function I overlooked?), and 2) although I've tested this with all edge cases that I'm aware of, I can't be sure that this entirely fixes this issue, or that it doesn't break anything else.
The text was updated successfully, but these errors were encountered:
nkouevda
added a commit
to nkouevda/vim-slash
that referenced
this issue
Sep 6, 2023
Problem
If e.g. 1) the first line in the window is wrapped, 2) the cursor is on any line below that, and 3)
*
would cause the view to move down (i.e. the next match is not yet visible), thenwinline() - s:winline
will usually compute an incorrectsdiff
, and we will<C-y>
more times than necessary, shifting the view up by at least 1 line (unless we were already at the beginning of the buffer, or there are some other edge cases).Possible solution
I believe using
winsaveview()['topline']
instead ofwinline()
avoids this discrepancy between buffer lines and screen lines.I'll put up a PR with that approach, but 1) I'm not sure if there's a simpler way to get
topline
(maybe some function I overlooked?), and 2) although I've tested this with all edge cases that I'm aware of, I can't be sure that this entirely fixes this issue, or that it doesn't break anything else.The text was updated successfully, but these errors were encountered: