mirror of
https://github.com/neovim/neovim.git
synced 2025-09-19 17:58:18 +00:00
feat(api): allow win_hide to close cmdwin or non-previous windows
This aligns its behaviour better with `nvim_win_close`. Note that `:hide` is actually incapable of closing the cmdwin, unlike `:close` and `:quit`, so this is a bit of a difference in behaviour.
This commit is contained in:
@@ -362,10 +362,10 @@ Boolean nvim_win_is_valid(Window window)
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_win_hide(Window window, Error *err)
|
||||
FUNC_API_SINCE(7)
|
||||
FUNC_API_TEXTLOCK
|
||||
FUNC_API_TEXTLOCK_ALLOW_CMDWIN
|
||||
{
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
if (!win) {
|
||||
if (!win || !can_close_in_cmdwin(win, err)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -397,20 +397,10 @@ void nvim_win_close(Window window, Boolean force, Error *err)
|
||||
FUNC_API_TEXTLOCK_ALLOW_CMDWIN
|
||||
{
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
if (!win) {
|
||||
if (!win || !can_close_in_cmdwin(win, err)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmdwin_type != 0) {
|
||||
if (win == curwin) {
|
||||
cmdwin_result = Ctrl_C;
|
||||
return;
|
||||
} else if (win == cmdwin_old_curwin) {
|
||||
api_set_error(err, kErrorTypeException, "%s", e_cmdwin);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
tabpage_T *tabpage = win_find_tabpage(win);
|
||||
TryState tstate;
|
||||
try_enter(&tstate);
|
||||
|
Reference in New Issue
Block a user