From 842725eedc1fce7ec1f4ab593215589b3029d6ae Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 5 Jul 2024 07:46:01 +0800 Subject: vim-patch:9.1.0525: Right release selects immediately when pum is truncated. (#29568) Problem: Right release selects immediately when pum is truncated. Solution: Use pum_height instead of pum_size when checking click row. Don't place it above mouse row when there is more space below. (zeertzjq) fixes: vim/vim#15101 closes: vim/vim#15102 https://github.com/vim/vim/commit/761a420c66402545acd8ee3ffa17c3a1fc3110e4 --- src/nvim/popupmenu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c index 8608a2c866..64db351dfa 100644 --- a/src/nvim/popupmenu.c +++ b/src/nvim/popupmenu.c @@ -1265,8 +1265,9 @@ static void pum_position_at_mouse(int min_width) pum_anchor_grid = mouse_grid; } - if (max_row - mouse_row > pum_size) { - // Enough space below the mouse row. + if (max_row - mouse_row > pum_size || max_row - mouse_row > mouse_row - min_row) { + // Enough space below the mouse row, + // or there is more space below the mouse row than above. pum_above = false; pum_row = mouse_row + 1; if (pum_height > max_row - pum_row) { @@ -1322,7 +1323,7 @@ static void pum_select_mouse_pos(void) int idx = mouse_row - pum_row; - if (idx < 0 || idx >= pum_size) { + if (idx < 0 || idx >= pum_height) { pum_selected = -1; } else if (*pum_array[idx].pum_text != NUL) { pum_selected = idx; -- cgit