summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-11-19 13:14:10 +0000
committerBram Moolenaar <Bram@vim.org>2022-11-19 13:14:10 +0000
commit9fda81515b26ecd3c1e99f95334aaed3f7b6fea3 (patch)
tree12a4d3d606b0ee1d1dda7aa9799f5286462153cb /src/window.c
parent361895d2a15b4b0bbbb4c009261eab5b3d69ebf1 (diff)
downloadvim-git-9fda81515b26ecd3c1e99f95334aaed3f7b6fea3.tar.gz
patch 9.0.0909: error message for layout change does not match actionv9.0.0909
Problem: Error message for layout change does not match action. Solution: Pass the command to where the error is given. (closes #11573)
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/window.c b/src/window.c
index a64a52e80..422f4faba 100644
--- a/src/window.c
+++ b/src/window.c
@@ -111,13 +111,15 @@ window_layout_unlock(void)
/*
* When the window layout cannot be changed give an error and return TRUE.
+ * "cmd" indicates the action being performed and is used to pick the relevant
+ * error message.
*/
int
-window_layout_locked(void)
+window_layout_locked(enum CMD_index cmd)
{
if (split_disallowed > 0 || close_disallowed > 0)
{
- if (close_disallowed == 0)
+ if (close_disallowed == 0 && cmd == CMD_tabnew)
emsg(_(e_cannot_split_window_when_closing_buffer));
else
emsg(_(e_not_allowed_to_change_window_layout_in_this_autocmd));
@@ -2573,7 +2575,7 @@ win_close(win_T *win, int free_buf)
emsg(_(e_cannot_close_last_window));
return FAIL;
}
- if (window_layout_locked())
+ if (window_layout_locked(CMD_close))
return FAIL;
if (win->w_closing || (win->w_buffer != NULL
@@ -4062,7 +4064,7 @@ win_new_tabpage(int after)
emsg(_(e_invalid_in_cmdline_window));
return FAIL;
}
- if (window_layout_locked())
+ if (window_layout_locked(CMD_tabnew))
return FAIL;
newtp = alloc_tabpage();