diff options
author | glepnir <glephunter@gmail.com> | 2024-12-24 18:12:50 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-12-24 18:56:40 +0800 |
commit | 05eca4c04d4d2cc6ad3a2af69d76085135e9b16c (patch) | |
tree | fe4fea9e86bcd74a70b2e0ea7590bd07f69a412b /src/nvim/popupmenu.c | |
parent | a103ec7449c4a318788b519cdeac2e525136b66b (diff) | |
download | rneovim-05eca4c04d4d2cc6ad3a2af69d76085135e9b16c.tar.gz rneovim-05eca4c04d4d2cc6ad3a2af69d76085135e9b16c.tar.bz2 rneovim-05eca4c04d4d2cc6ad3a2af69d76085135e9b16c.zip |
vim-patch:9.1.0956: completion may crash, completion highlight wrong with preview window
Problem: completion may crash, completion highlight wrong with preview
window (after v9.1.0954)
Solution: correctly calculate scroll offset, check for preview window
when adding extra highlighting
(glepnir)
when there have a preview window prepare_tagpreview
will change curwin to preview window and this may cause
ComplMatchIns check condition not correct. check wp is curwin
and also the type of wp is not a preview or poup info
fixes: https://github.com/vim/vim/issues/16284
closes: https://github.com/vim/vim/pull/16283
https://github.com/vim/vim/commit/8d0bb6dc9f2e5d94ebb59671d592c1b7fa325ca6
Diffstat (limited to 'src/nvim/popupmenu.c')
-rw-r--r-- | src/nvim/popupmenu.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c index 70a479239e..75e5a52829 100644 --- a/src/nvim/popupmenu.c +++ b/src/nvim/popupmenu.c @@ -906,10 +906,10 @@ static bool pum_set_selected(int n, int repeat) { bool resized = false; int context = pum_height / 2; - int scroll_offset = pum_selected - pum_height; int prev_selected = pum_selected; pum_selected = n; + int scroll_offset = pum_selected - pum_height; unsigned cur_cot_flags = get_cot_flags(); bool use_float = (cur_cot_flags & kOptCotFlagPopup) != 0; @@ -940,7 +940,7 @@ static bool pum_set_selected(int n, int repeat) // scroll up; when we did a jump it's probably a PageDown then // scroll a whole page if (pum_first < scroll_offset + 3) { - pum_first = MAX(pum_first, scroll_offset + 1); + pum_first = MAX(pum_first + pum_height - 2, scroll_offset + 1); } else { pum_first = scroll_offset + 1; } @@ -953,7 +953,7 @@ static bool pum_set_selected(int n, int repeat) if (pum_first > pum_selected - context) { pum_first = MAX(pum_selected - context, 0); // scroll down } else if (pum_first < pum_selected + context - pum_height + 1) { - pum_first = pum_selected + context - pum_height + 1; // up + pum_first = pum_selected + context - pum_height + 1; // up } } // adjust for the number of lines displayed |