aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorglepnir <glephunter@gmail.com>2025-03-10 22:38:15 +0800
committerGitHub <noreply@github.com>2025-03-10 07:38:15 -0700
commitafc3c43f12e2d9d8114c29636ba976f732efc3ed (patch)
tree9853a8f24b3b8ad1c4ff4eceb612268b5f2254ad /src
parent40a149e7f9926d29f19457da6a397b3b58b0b40f (diff)
downloadrneovim-afc3c43f12e2d9d8114c29636ba976f732efc3ed.tar.gz
rneovim-afc3c43f12e2d9d8114c29636ba976f732efc3ed.tar.bz2
rneovim-afc3c43f12e2d9d8114c29636ba976f732efc3ed.zip
fix(popup): new preview_bufnr created when menu item is selected #32819
Problem: "use_float" in the if-condition causes a new buffer to be generated on every execution. Solution: - Remove the incorrect use_float check from the condition. - Use buf_clear to properly clear the existing buffer.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/popupmenu.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c
index b057cae08d..d7909e6872 100644
--- a/src/nvim/popupmenu.c
+++ b/src/nvim/popupmenu.c
@@ -1039,12 +1039,9 @@ static bool pum_set_selected(int n, int repeat)
&& (curbuf->b_nwindows == 1)
&& (curbuf->b_fname == NULL)
&& bt_nofile(curbuf)
- && (curbuf->b_p_bh[0] == 'w')
- && !use_float) {
+ && (curbuf->b_p_bh[0] == 'w')) {
// Already a "wipeout" buffer, make it empty.
- while (!buf_is_empty(curbuf)) {
- ml_delete(1, false);
- }
+ buf_clear();
} else {
// Don't want to sync undo in the current buffer.
no_u_sync++;