Skip to content
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

fix: small windows no longer constantly throw errors #1824

Merged
merged 1 commit into from
Mar 21, 2024
Merged

fix: small windows no longer constantly throw errors #1824

merged 1 commit into from
Mar 21, 2024

Conversation

hankertrix
Copy link
Contributor

@hankertrix hankertrix commented Feb 12, 2024

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 the nvim_win_set_cursor being passed a nil value for self.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 whether self.entries_win.win is nil 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. The nvim_open_win function call to create the scrollbar background throws the error when self.style.height is 0. Hence, an additional check is added alongside the info.scrollable check which also skips drawing the scrollbar thumb as it is not needed when the height is 0 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.

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 the
nvim_win_set_cursor being passed a nil value for self.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 whether
self.entries_win.win is nil 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.
The nvim_open_win function call to create the scrollbar
background throws the error when self.style.height is 0. Hence, an
additional check is added alongside the info.scrollable check which also
skips drawing the scrollbar thumb as it is not needed when the height is
0 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.
@hrsh7th
Copy link
Owner

hrsh7th commented Mar 21, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using nvim-cmp with firenvim cause problem
2 participants