0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 9.0.0909: error message for layout change does not match action

Problem:    Error message for layout change does not match action.
Solution:   Pass the command to where the error is given. (closes #11573)
This commit is contained in:
Bram Moolenaar
2022-11-19 13:14:10 +00:00
parent 361895d2a1
commit 9fda81515b
5 changed files with 23 additions and 11 deletions

View File

@@ -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();