From 22d9338afceae5f8ef3845f152dea07a19d512d1 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Thu, 17 Aug 2023 00:53:10 +0100 Subject: fix(api): disallow win_set_buf from changing cmdwin's old curbuf (#24745) A command typed in the cmdwin and executed with `` is expected to be executed in the context of the old curwin/buf, so it shouldn't be changed. --- src/nvim/api/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index f74071a002..001797add5 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -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; } -- cgit