`*` incorrectly restores view due to wrapped lines
- Dominant language
- Vim Script
- Stars
- 330
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
### 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), then [`winline() - s:winline`](https://github.com/junegunn/vim-slash/blob/31aee09b7ea8893a18fa34f65e63e364fc998444/plugin/slash.vim#L46) will usually compute an incorrect `sdiff`, and we will `` 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.