0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

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:
Bram Moolenaar
2019-07-13 16:38:50 +02:00
parent b073da8929
commit a901a37bae
9 changed files with 114 additions and 0 deletions

View File

@@ -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"),