neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 5943a81fe79a0d9a639af88452050a5056e9027d
parent 9763834170dda77ea25799dba403d6cbd513600f
Author: glepnir <glephunter@gmail.com>
Date:   Sat, 28 Feb 2026 21:20:56 +0800

fix(float): style=minimal leaks into normal windows #25185

Problem: closing a minimal float saves its style-imposed options into
buffer's wininfo, which get picked up by normal windows on :bnext.

Solution: don't save window options to wininfo for style=minimal windows.
Diffstat:
Msrc/nvim/buffer.c | 5+++--
Mtest/functional/ui/float_spec.lua | 10++++++++--
2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c @@ -599,7 +599,7 @@ bool close_buffer(win_T *win, buf_T *buf, int action, bool abort_if_last, bool i } buflist_setfpos(buf, win, win->w_cursor.lnum == 1 ? 0 : win->w_cursor.lnum, - win->w_cursor.col, true); + win->w_cursor.col, win->w_config.style != kWinStyleMinimal); } bufref_T bufref; @@ -3215,7 +3215,8 @@ void buflist_slash_adjust(void) /// Also save the local window option values. void buflist_altfpos(win_T *win) { - buflist_setfpos(curbuf, win, win->w_cursor.lnum, win->w_cursor.col, true); + buflist_setfpos(curbuf, win, win->w_cursor.lnum, win->w_cursor.col, + win->w_config.style != kWinStyleMinimal); } /// Check that "ffname" is not the same file as current file. diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua @@ -407,13 +407,19 @@ describe('float window', function() assert_alive() end) - it("should re-apply 'style' when present", function() + it("should re-apply 'style' when present and not leak to normal windows", function() + local buf = api.nvim_create_buf(true, false) local float_opts = { style = 'minimal', relative = 'editor', row = 1, col = 1, width = 1, height = 1 } - local float_win = api.nvim_open_win(0, true, float_opts) + local float_win = api.nvim_open_win(buf, true, float_opts) api.nvim_set_option_value('number', true, { win = float_win }) float_opts.row = 2 api.nvim_win_set_config(float_win, float_opts) eq(false, api.nvim_get_option_value('number', { win = float_win })) + -- closing the float should not leak minimal style options to normal windows + api.nvim_win_close(float_win, true) + api.nvim_set_option_value('number', true, { win = 0 }) + command('bnext') + eq(true, api.nvim_get_option_value('number', { win = 0 })) end) it("should not re-apply 'style' when missing", function()