-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use text scale in calculating visible window height #1499
base: master
Are you sure you want to change the base?
Use text scale in calculating visible window height #1499
Conversation
That's great news, thanks. I'll take a look on the weekend. Agree I'd like @chopptimus to take a look if possible. |
I noticed that one of the edge cases that @chopptimus pointed out still fails -- if you have a long wrapped line that fills the entire screen, then Some notes towards a fix:
Any preferences here @tomdl89 ? |
Vims behaviour when scrolling long wrapped lines is pretty inconsistent. If I have a window with 50 lines of text visible but only 5 lines of code, vim scrolls 4 lines, and if I have only a single line of code visible it scrolls a single line. The fix works for the first issue I reported. |
Some notes from testing:
|
@chopptimus , yeah that's exactly what I noticed too. @tomdl89 good points, I'll take another look when I have a chance unless you get to it first. |
Fixes #1497
@tomdl89 your idea to use text scale works perfectly. Initially I did think it was over-reporting the window height, but upon closer inspection, it is reporting the total number of visible lines of text, not lines of code, which is exactly what we are looking for, and matches Vim behavior as well as far as I was able to check.
To test:
100ihello<RET><esc>
(evil-window-visible-height)
at different zoom levels. It should report the correct value20ihello<space><esc>
along with other, regular-length lines(evil-window-visible-height)
again. It will show a larger number than what is actually displayed in line numbers on the screen.global-display-line-numbers-mode
), count the number of blanks between line numbers. These are lines that are actually displayed, but which do not correspond to line numbers because the lines are wrapped. Add this number to the visible number and you should get the number reported byevil-window-visible-height
.Looking at the behavior in Vim, I wasn't able to detect a difference at different zoom levels, or at the end of the buffer.
cc @chopptimus - please let us know if you have a chance to verify the fix and notice any differences, and thank you for reporting it 🙏