diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/drawline.c | 4 | ||||
-rw-r--r-- | src/nvim/insexpand.c | 6 | ||||
-rw-r--r-- | src/nvim/popupmenu.c | 6 |
3 files changed, 11 insertions, 5 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index 35a41f840d..3062b0f2a3 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -1495,7 +1495,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s ptr = line + v; // "line" may have been updated } - if ((State & MODE_INSERT) && in_curline && ins_compl_active()) { + if ((State & MODE_INSERT) && in_curline && ins_compl_win_active(wp)) { area_highlighting = true; } @@ -1746,7 +1746,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s } // Check if ComplMatchIns highlight is needed. - if ((State & MODE_INSERT) && in_curline && ins_compl_active()) { + if ((State & MODE_INSERT) && in_curline && ins_compl_win_active(wp)) { int ins_match_attr = ins_compl_col_range_attr((int)(ptr - line)); if (ins_match_attr > 0) { search_attr = hl_combine_attr(search_attr, ins_match_attr); diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index aee3603d75..7245b0d6ce 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -1722,6 +1722,12 @@ bool ins_compl_active(void) return compl_started; } +/// Return true when wp is the actual completion window +bool ins_compl_win_active(win_T *wp) +{ + return ins_compl_active() && !(wp->w_p_pvw || wp->w_float_is_info); +} + /// Selected one of the matches. When false the match was edited or using the /// longest common string. bool ins_compl_used_match(void) 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 |