mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user