forked from aniani/vim
patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Problem: When using popup_menu() does not scroll to show the selected line. Solution: Scroll the text. (Naruhiko Nishino, closes #4651)
This commit is contained in:
@@ -1512,6 +1512,12 @@ popup_highlight_curline(win_T *wp)
|
||||
|
||||
match_delete(wp, 1, FALSE);
|
||||
|
||||
// Scroll to show the line with the cursor. This assumes lines don't wrap.
|
||||
while (wp->w_topline + wp->w_height - 1 < wp->w_cursor.lnum)
|
||||
wp->w_topline++;
|
||||
while (wp->w_cursor.lnum < wp->w_topline)
|
||||
wp->w_topline--;
|
||||
|
||||
id = syn_name2id((char_u *)"PopupSelected");
|
||||
vim_snprintf(buf, sizeof(buf), "\\%%%dl.*", (int)wp->w_cursor.lnum);
|
||||
match_add(wp, (char_u *)(id == 0 ? "PmenuSel" : "PopupSelected"),
|
||||
|
Reference in New Issue
Block a user