mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
Merge pull request #23580 from neovim/backport-23492-to-release-0.9
[Backport release-0.9] fix(api): don't change title when setting buffer in a window
This commit is contained in:
@@ -667,6 +667,8 @@ void win_set_buf(Window window, Buffer buffer, bool noautocmd, Error *err)
|
|||||||
|
|
||||||
tabpage_T *tab = win_find_tabpage(win);
|
tabpage_T *tab = win_find_tabpage(win);
|
||||||
|
|
||||||
|
// no redrawing and don't set the window title
|
||||||
|
RedrawingDisabled++;
|
||||||
if (noautocmd) {
|
if (noautocmd) {
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
}
|
}
|
||||||
@@ -696,6 +698,7 @@ void win_set_buf(Window window, Buffer buffer, bool noautocmd, Error *err)
|
|||||||
if (noautocmd) {
|
if (noautocmd) {
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
}
|
}
|
||||||
|
RedrawingDisabled--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new float.
|
/// Create a new float.
|
||||||
|
@@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local spawn, set_session, clear = helpers.spawn, helpers.set_session, helpers.clear
|
local spawn, set_session, clear = helpers.spawn, helpers.set_session, helpers.clear
|
||||||
local feed, command = helpers.feed, helpers.command
|
local feed, command = helpers.feed, helpers.command
|
||||||
|
local curwin = helpers.curwin
|
||||||
local insert = helpers.insert
|
local insert = helpers.insert
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
@@ -189,6 +190,52 @@ local function screen_tests(linegrid)
|
|||||||
eq(expected, screen.title)
|
eq(expected, screen.title)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('setting the buffer of another window using RPC', function()
|
||||||
|
local oldwin = curwin().id
|
||||||
|
command('split')
|
||||||
|
meths.win_set_buf(oldwin, buf2)
|
||||||
|
command('redraw!')
|
||||||
|
screen:expect(function()
|
||||||
|
eq(expected, screen.title)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('setting the buffer of another window using Lua callback', function()
|
||||||
|
local oldwin = curwin().id
|
||||||
|
command('split')
|
||||||
|
exec_lua(string.format([[
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.api.nvim_win_set_buf(%d, %d)
|
||||||
|
end)
|
||||||
|
]], oldwin, buf2))
|
||||||
|
command('redraw!')
|
||||||
|
screen:expect(function()
|
||||||
|
eq(expected, screen.title)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('creating a floating window using RPC', function()
|
||||||
|
meths.open_win(buf2, false, {
|
||||||
|
relative = 'editor', width = 5, height = 5, row = 0, col = 0,
|
||||||
|
})
|
||||||
|
command('redraw!')
|
||||||
|
screen:expect(function()
|
||||||
|
eq(expected, screen.title)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('creating a floating window using Lua callback', function()
|
||||||
|
exec_lua(string.format([[
|
||||||
|
vim.api.nvim_open_win(%d, false, {
|
||||||
|
relative = 'editor', width = 5, height = 5, row = 0, col = 0,
|
||||||
|
})
|
||||||
|
]], buf2))
|
||||||
|
command('redraw!')
|
||||||
|
screen:expect(function()
|
||||||
|
eq(expected, screen.title)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user