aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/window.c
diff options
context:
space:
mode:
authorR. Simon <rasimon22@gmail.com>2019-08-10 06:41:35 -0500
committerJustin M. Keyes <justinkz@gmail.com>2019-08-10 13:41:35 +0200
commit5f243fc68ad0ab9c3bdf484c8f2753ec9414bf37 (patch)
tree73911f0c12875a5057944b2ff562399ee7c1f13d /src/nvim/api/window.c
parent278c5d452c2cbc436a9cc317407ae6021a226c3a (diff)
downloadrneovim-5f243fc68ad0ab9c3bdf484c8f2753ec9414bf37.tar.gz
rneovim-5f243fc68ad0ab9c3bdf484c8f2753ec9414bf37.tar.bz2
rneovim-5f243fc68ad0ab9c3bdf484c8f2753ec9414bf37.zip
API: nvim_win_close: Fix closing cmdline-window #10087
Diffstat (limited to 'src/nvim/api/window.c')
-rw-r--r--src/nvim/api/window.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c
index 4922dd7efc..0103e17176 100644
--- a/src/nvim/api/window.c
+++ b/src/nvim/api/window.c
@@ -6,6 +6,8 @@
#include <stdlib.h>
#include <limits.h>
+#include "nvim/ascii.h"
+#include "nvim/globals.h"
#include "nvim/api/window.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
@@ -18,7 +20,6 @@
#include "nvim/screen.h"
#include "nvim/move.h"
-
/// Gets the current buffer in a window
///
/// @param window Window handle
@@ -526,9 +527,7 @@ Dictionary nvim_win_get_config(Window window, Error *err)
return rv;
}
-/// Close a window.
-///
-/// This is equivalent to |:close| with count except that it takes a window id.
+/// Closes the window (like |:close| with a |window-ID|).
///
/// @param window Window handle
/// @param force Behave like `:close!` The last window of a buffer with
@@ -546,6 +545,10 @@ void nvim_win_close(Window window, Boolean force, Error *err)
TryState tstate;
try_enter(&tstate);
- ex_win_close(force, win, tabpage == curtab ? NULL : tabpage);
+ if (cmdwin_type != 0 && win == curwin) {
+ cmdwin_result = Ctrl_C;
+ } else {
+ ex_win_close(force, win, tabpage == curtab ? NULL : tabpage);
+ }
vim_ignored = try_leave(&tstate, err);
}