Use text scale in calculating visible window height #1499
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.
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 🙏