diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-06-30 21:42:39 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-01 10:28:07 +0800 |
commit | 5a62ad605e4945562d5defb5eb6a2e8a88107ebf (patch) | |
tree | e85448107d27109df805e865053468e199956dbe /src | |
parent | 236947ab20b82417eb4f3f69dd46740f299b7fdf (diff) | |
download | rneovim-5a62ad605e4945562d5defb5eb6a2e8a88107ebf.tar.gz rneovim-5a62ad605e4945562d5defb5eb6a2e8a88107ebf.tar.bz2 rneovim-5a62ad605e4945562d5defb5eb6a2e8a88107ebf.zip |
feat(ui): make right-click menu work properly with ext_multigrid
Add tests both with and without ext_multigrid.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/popupmnu.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index befed415a6..ba151b5ce2 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -940,14 +940,17 @@ void pum_set_event_info(dict_T *dict) static void pum_position_at_mouse(int min_width) { + pum_anchor_grid = mouse_grid; if (Rows - mouse_row > pum_size) { // Enough space below the mouse row. + pum_above = false; pum_row = mouse_row + 1; if (pum_height > Rows - pum_row) { pum_height = Rows - pum_row; } } else { // Show above the mouse row, reduce height if it does not fit. + pum_above = true; pum_row = mouse_row - pum_size; if (pum_row < 0) { pum_height += pum_row; @@ -971,6 +974,14 @@ static void pum_position_at_mouse(int min_width) /// Select the pum entry at the mouse position. static void pum_select_mouse_pos(void) { + if (mouse_grid == pum_grid.handle) { + pum_selected = mouse_row; + return; + } else if (mouse_grid > 1) { + pum_selected = -1; + return; + } + int idx = mouse_row - pum_row; if (idx < 0 || idx >= pum_size) { |