mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 17:28:23 +00:00
fix(api): disallow win_set_buf from changing cmdwin's old curbuf (#24745)
A command typed in the cmdwin and executed with `<CR>` is expected to be executed in the context of the old curwin/buf, so it shouldn't be changed.
This commit is contained in:
@@ -58,7 +58,7 @@ void nvim_win_set_buf(Window window, Buffer buffer, Error *err)
|
||||
if (!win || !buf) {
|
||||
return;
|
||||
}
|
||||
if (cmdwin_type != 0 && (win == curwin || buf == curbuf)) {
|
||||
if (cmdwin_type != 0 && (win == curwin || win == cmdwin_old_curwin || buf == curbuf)) {
|
||||
api_set_error(err, kErrorTypeException, "%s", e_cmdwin);
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user