1
0
forked from aniani/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: #16284
closes: #16283

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
glepnir
2024-12-24 09:44:35 +01:00
committed by Christian Brabandt
parent f07c10d7bb
commit 8d0bb6dc9f
7 changed files with 66 additions and 5 deletions

View File

@@ -917,7 +917,7 @@ pum_set_selected(int n, int repeat UNUSED)
{
int resized = FALSE;
int context = pum_height / 2;
int scroll_offset = pum_selected - pum_height;
int scroll_offset;
#ifdef FEAT_QUICKFIX
int prev_selected = pum_selected;
unsigned cur_cot_flags = get_cot_flags();
@@ -927,6 +927,7 @@ pum_set_selected(int n, int repeat UNUSED)
#endif
pum_selected = n;
scroll_offset = pum_selected - pum_height;
if (pum_selected >= 0 && pum_selected < pum_size)
{
@@ -950,7 +951,7 @@ pum_set_selected(int n, int repeat UNUSED)
// 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;
}