mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Merge remote-tracking branch 'vim/master'
This commit is contained in:
+8
-2
@@ -595,6 +595,7 @@ close_buffer(
|
||||
if (buf->b_nwindows == 1)
|
||||
{
|
||||
++buf->b_locked;
|
||||
++buf->b_locked_split;
|
||||
if (apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname, buf->b_fname,
|
||||
FALSE, buf)
|
||||
&& !bufref_valid(&bufref))
|
||||
@@ -605,6 +606,7 @@ aucmd_abort:
|
||||
return FALSE;
|
||||
}
|
||||
--buf->b_locked;
|
||||
--buf->b_locked_split;
|
||||
if (abort_if_last && one_window())
|
||||
// Autocommands made this the only window.
|
||||
goto aucmd_abort;
|
||||
@@ -614,12 +616,14 @@ aucmd_abort:
|
||||
if (!unload_buf)
|
||||
{
|
||||
++buf->b_locked;
|
||||
++buf->b_locked_split;
|
||||
if (apply_autocmds(EVENT_BUFHIDDEN, buf->b_fname, buf->b_fname,
|
||||
FALSE, buf)
|
||||
&& !bufref_valid(&bufref))
|
||||
// Autocommands deleted the buffer.
|
||||
goto aucmd_abort;
|
||||
--buf->b_locked;
|
||||
--buf->b_locked_split;
|
||||
if (abort_if_last && one_window())
|
||||
// Autocommands made this the only window.
|
||||
goto aucmd_abort;
|
||||
@@ -804,6 +808,7 @@ buf_freeall(buf_T *buf, int flags)
|
||||
|
||||
// Make sure the buffer isn't closed by autocommands.
|
||||
++buf->b_locked;
|
||||
++buf->b_locked_split;
|
||||
set_bufref(&bufref, buf);
|
||||
if (buf->b_ml.ml_mfp != NULL)
|
||||
{
|
||||
@@ -830,6 +835,7 @@ buf_freeall(buf_T *buf, int flags)
|
||||
return;
|
||||
}
|
||||
--buf->b_locked;
|
||||
--buf->b_locked_split;
|
||||
|
||||
// If the buffer was in curwin and the window has changed, go back to that
|
||||
// window, if it still exists. This avoids that ":edit x" triggering a
|
||||
@@ -1722,8 +1728,8 @@ set_curbuf(buf_T *buf, int action)
|
||||
set_bufref(&prevbufref, prevbuf);
|
||||
set_bufref(&newbufref, buf);
|
||||
|
||||
// Autocommands may delete the current buffer and/or the buffer we want to go
|
||||
// to. In those cases don't close the buffer.
|
||||
// Autocommands may delete the current buffer and/or the buffer we want to
|
||||
// go to. In those cases don't close the buffer.
|
||||
if (!apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf)
|
||||
|| (bufref_valid(&prevbufref)
|
||||
&& bufref_valid(&newbufref)
|
||||
|
||||
+4
-4
@@ -945,7 +945,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
|
||||
if (**arg != ':')
|
||||
{
|
||||
if (*skipwhite(*arg) == ':')
|
||||
semsg(_(e_no_white_space_allowed_before_str), ":");
|
||||
semsg(_(e_no_white_space_allowed_before_str_str), ":", *arg);
|
||||
else
|
||||
semsg(_(e_missing_dict_colon), *arg);
|
||||
clear_tv(&tvkey);
|
||||
@@ -970,7 +970,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
|
||||
}
|
||||
if (vim9script && (*arg)[1] != NUL && !VIM_ISWHITE((*arg)[1]))
|
||||
{
|
||||
semsg(_(e_white_space_required_after_str), ":");
|
||||
semsg(_(e_white_space_required_after_str_str), ":", *arg);
|
||||
clear_tv(&tvkey);
|
||||
goto failret;
|
||||
}
|
||||
@@ -1012,7 +1012,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
|
||||
{
|
||||
if (vim9script && (*arg)[1] != NUL && !VIM_ISWHITE((*arg)[1]))
|
||||
{
|
||||
semsg(_(e_white_space_required_after_str), ",");
|
||||
semsg(_(e_white_space_required_after_str_str), ",", *arg);
|
||||
goto failret;
|
||||
}
|
||||
*arg = skipwhite(*arg + 1);
|
||||
@@ -1025,7 +1025,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
|
||||
if (!had_comma)
|
||||
{
|
||||
if (**arg == ',')
|
||||
semsg(_(e_no_white_space_allowed_before_str), ",");
|
||||
semsg(_(e_no_white_space_allowed_before_str_str), ",", *arg);
|
||||
else
|
||||
semsg(_(e_missing_dict_comma), *arg);
|
||||
goto failret;
|
||||
|
||||
+8
-4
@@ -173,10 +173,10 @@ EXTERN char e_cannot_declare_a_register_str[]
|
||||
INIT(= N_("E1066: Cannot declare a register: %s"));
|
||||
EXTERN char e_separator_mismatch_str[]
|
||||
INIT(= N_("E1067: Separator mismatch: %s"));
|
||||
EXTERN char e_no_white_space_allowed_before_str[]
|
||||
INIT(= N_("E1068: No white space allowed before '%s'"));
|
||||
EXTERN char e_white_space_required_after_str[]
|
||||
INIT(= N_("E1069: White space required after '%s'"));
|
||||
EXTERN char e_no_white_space_allowed_before_str_str[]
|
||||
INIT(= N_("E1068: No white space allowed before '%s': %s"));
|
||||
EXTERN char e_white_space_required_after_str_str[]
|
||||
INIT(= N_("E1069: White space required after '%s': %s"));
|
||||
EXTERN char e_missing_from[]
|
||||
INIT(= N_("E1070: Missing \"from\""));
|
||||
EXTERN char e_invalid_string_after_from[]
|
||||
@@ -353,3 +353,7 @@ EXTERN char e_missing_return_type[]
|
||||
INIT(= N_("E1157: Missing return type"));
|
||||
EXTERN char e_cannot_use_flatten_in_vim9_script[]
|
||||
INIT(= N_("E1158: Cannot use flatten() in Vim9 script"));
|
||||
EXTERN char e_cannot_split_window_when_closing_buffer[]
|
||||
INIT(= N_("E1159: Cannot split a window when closing the buffer"));
|
||||
EXTERN char e_cannot_use_default_for_variable_arguments[]
|
||||
INIT(= N_("E1160: Cannot use a default for variable arguments"));
|
||||
|
||||
+1
-2
@@ -5218,8 +5218,7 @@ ends_excmd2(char_u *cmd_start UNUSED, char_u *cmd)
|
||||
return TRUE;
|
||||
#ifdef FEAT_EVAL
|
||||
if (in_vim9script())
|
||||
return c == '#' && cmd[1] != '{'
|
||||
&& (cmd == cmd_start || VIM_ISWHITE(cmd[-1]));
|
||||
return c == '#' && (cmd == cmd_start || VIM_ISWHITE(cmd[-1]));
|
||||
#endif
|
||||
return c == '"';
|
||||
}
|
||||
|
||||
+4
-1
@@ -3360,7 +3360,10 @@ dos_expandpath(
|
||||
if (p == NULL)
|
||||
break; // out of memory
|
||||
|
||||
if (*wfb.cAlternateFileName == NUL)
|
||||
// Do not use the alternate filename when the file name ends in '~',
|
||||
// because it picks up backup files: short name for "foo.vim~" is
|
||||
// "foo~1.vim", which matches "*.vim".
|
||||
if (*wfb.cAlternateFileName == NUL || p[STRLEN(p) - 1] == '~')
|
||||
p_alt = NULL;
|
||||
else
|
||||
p_alt = utf16_to_enc(wfb.cAlternateFileName, NULL);
|
||||
|
||||
+3
-2
@@ -1311,7 +1311,7 @@ eval_list(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int do_error)
|
||||
{
|
||||
if (vim9script && !IS_WHITE_OR_NUL((*arg)[1]) && (*arg)[1] != ']')
|
||||
{
|
||||
semsg(_(e_white_space_required_after_str), ",");
|
||||
semsg(_(e_white_space_required_after_str_str), ",", *arg);
|
||||
goto failret;
|
||||
}
|
||||
*arg = skipwhite(*arg + 1);
|
||||
@@ -1328,7 +1328,8 @@ eval_list(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int do_error)
|
||||
if (do_error)
|
||||
{
|
||||
if (**arg == ',')
|
||||
semsg(_(e_no_white_space_allowed_before_str), ",");
|
||||
semsg(_(e_no_white_space_allowed_before_str_str),
|
||||
",", *arg);
|
||||
else
|
||||
semsg(_("E696: Missing comma in List: %s"), *arg);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1941,7 +1941,7 @@ popup_create(typval_T *argvars, typval_T *rettv, create_type_T type)
|
||||
buf->b_p_ul = -1; // no undo
|
||||
buf->b_p_swf = FALSE; // no swap file
|
||||
buf->b_p_bl = FALSE; // unlisted buffer
|
||||
buf->b_locked = TRUE;
|
||||
buf->b_locked = TRUE; // prevent deleting the buffer
|
||||
|
||||
// Avoid that 'buftype' is reset when this buffer is entered.
|
||||
buf->b_p_initialized = TRUE;
|
||||
|
||||
+4
-1
@@ -1319,6 +1319,9 @@ do_source(
|
||||
}
|
||||
// imports can be redefined once
|
||||
mark_imports_for_reload(sid);
|
||||
|
||||
// reset version, "vim9script" may have been added or removed.
|
||||
si->sn_version = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1457,7 +1460,7 @@ almosttheend:
|
||||
if (si->sn_save_cpo != NULL)
|
||||
{
|
||||
set_option_value((char_u *)"cpo", 0L, si->sn_save_cpo, 0);
|
||||
CLEAR_POINTER(si->sn_save_cpo);
|
||||
VIM_CLEAR(si->sn_save_cpo);
|
||||
}
|
||||
|
||||
restore_funccal();
|
||||
|
||||
@@ -2636,6 +2636,8 @@ struct file_buffer
|
||||
int b_flags; // various BF_ flags
|
||||
int b_locked; // Buffer is being closed or referenced, don't
|
||||
// let autocommands wipe it out.
|
||||
int b_locked_split; // Buffer is being closed, don't allow opening
|
||||
// a new window with it.
|
||||
|
||||
/*
|
||||
* b_ffname has the full path of the file (NULL for no name).
|
||||
|
||||
@@ -2761,15 +2761,15 @@ endfunc
|
||||
|
||||
" Fuzzer found some strange combination that caused a crash.
|
||||
func Test_autocmd_normal_mess()
|
||||
" TODO: why does this hang on Windows?
|
||||
" For unknown reason this hangs on MS-Windows
|
||||
CheckNotMSWindows
|
||||
|
||||
augroup aucmd_normal_test
|
||||
au BufLeave,BufWinLeave,BufHidden,BufUnload,BufDelete,BufWipeout * norm 7q/qc
|
||||
augroup END
|
||||
o4
|
||||
call assert_fails('o4', 'E1159')
|
||||
silent! H
|
||||
e xx
|
||||
call assert_fails('e xx', 'E1159')
|
||||
normal G
|
||||
|
||||
augroup aucmd_normal_test
|
||||
@@ -2778,6 +2778,9 @@ func Test_autocmd_normal_mess()
|
||||
endfunc
|
||||
|
||||
func Test_autocmd_closing_cmdwin()
|
||||
" For unknown reason this hangs on MS-Windows
|
||||
CheckNotMSWindows
|
||||
|
||||
au BufWinLeave * nested q
|
||||
call assert_fails("norm 7q?\n", 'E855:')
|
||||
|
||||
@@ -2791,8 +2794,8 @@ func Test_autocmd_vimgrep()
|
||||
au QuickfixCmdPre,BufNew,BufDelete,BufReadCmd * sb
|
||||
au QuickfixCmdPre,BufNew,BufDelete,BufReadCmd * q9 | ||||