aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorglepnir <glephunter@gmail.com>2025-02-27 18:41:29 +0800
committerGitHub <noreply@github.com>2025-02-27 02:41:29 -0800
commitac1c5ccb2c04177b526e0aa2ed286760fad98a5d (patch)
tree649fe81b3c728119dd2768ee317b058d3bdc06ba /src
parent6a9555c0faf3fbfc8001244ae2a19da4e92babd7 (diff)
downloadrneovim-ac1c5ccb2c04177b526e0aa2ed286760fad98a5d.tar.gz
rneovim-ac1c5ccb2c04177b526e0aa2ed286760fad98a5d.tar.bz2
rneovim-ac1c5ccb2c04177b526e0aa2ed286760fad98a5d.zip
fix(popup): reuse pum preview float win, set 'winfixbuf' #32636
Problem: popup floating window is closed and recreated for each item selection, this is a bit wasteful. Solution: - Hide the preview win (instead of closing it) when the menu is still displayed: 1. When selected_item is -1. 2. When switching from an item with an "info" field to one without. - When pum is undisplayed it is still closed.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/popupmenu.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c
index d1c6f647fd..2e533bea23 100644
--- a/src/nvim/popupmenu.c
+++ b/src/nvim/popupmenu.c
@@ -871,6 +871,7 @@ win_T *pum_set_info(int selected, char *info)
if (!wp) {
return NULL;
}
+ wp->w_p_wfb = true;
}
linenr_T lnum = 0;
int max_info_width = 0;
@@ -915,7 +916,8 @@ static bool pum_set_selected(int n, int repeat)
if (use_float && (pum_selected < 0 || pum_array[pum_selected].pum_info == NULL)) {
win_T *wp = win_float_find_preview();
if (wp) {
- win_close(wp, true, true);
+ wp->w_config.hide = true;
+ win_config_float(wp, wp->w_config);
}
}