fix: small windows no longer constantly throw errors #1824
Merged
+9
−2
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 #827 and #1759
The
entries_win:open
function will fail when either the width or the height of the window is less than 1, which will result in thenvim_win_set_cursor
being passed anil
value forself.entries_win.win
instead of a number, which causes an error to constantly appear when the window is small. Hence, a guard clause to check for whetherself.entries_win.win
isnil
is added to stop the error from occurring.Also fixed the rarer 'height' must be a positive Integer error caused by the
window.update
function, within the clause to draw the scrollbar background. This error happens on small windows when pressing and holding down the backspace key to delete a lot of characters at once. Thenvim_open_win
function call to create the scrollbar background throws the error whenself.style.height
is0
. Hence, an additional check is added alongside theinfo.scrollable
check which also skips drawing the scrollbar thumb as it is not needed when the height is0
and will result in a weird scrollbar thumb floating some distance away from the text when holding down backspace to delete a lot of characters.