vim-patch:8.0.0546: swap file exists briefly when opening the command window (#8588)

Problem:    Swap file exists briefly when opening the command window.
Solution:   Set the noswapfile command modifier before splitting the window.
            (James McCoy, closes vim/vim#1620)
3bab93998d
This commit is contained in:
Jan Edmund Lazo
2018-06-19 15:22:34 -04:00
committed by Justin M. Keyes
parent 74d19f685f
commit 3cc7462a0c
3 changed files with 9 additions and 7 deletions

View File

@@ -6033,10 +6033,11 @@ static void ex_cquit(exarg_T *eap)
static void ex_quit_all(exarg_T *eap) static void ex_quit_all(exarg_T *eap)
{ {
if (cmdwin_type != 0) { if (cmdwin_type != 0) {
if (eap->forceit) if (eap->forceit) {
cmdwin_result = K_XF1; /* ex_window() takes care of this */ cmdwin_result = K_XF1; // open_cmdwin() takes care of this
else } else {
cmdwin_result = K_XF2; cmdwin_result = K_XF2;
}
return; return;
} }

View File

@@ -861,7 +861,7 @@ static int command_line_execute(VimState *state, int key)
if (s->c == cedit_key || s->c == K_CMDWIN) { if (s->c == cedit_key || s->c == K_CMDWIN) {
if (ex_normal_busy == 0 && got_int == false) { if (ex_normal_busy == 0 && got_int == false) {
// Open a window to edit the command line (and history). // Open a window to edit the command line (and history).
s->c = ex_window(); s->c = open_cmdwin();
s->some_key_typed = true; s->some_key_typed = true;
} }
} else { } else {
@@ -1444,7 +1444,7 @@ static int command_line_handle_key(CommandLineState *s)
return command_line_not_changed(s); return command_line_not_changed(s);
case K_IGNORE: case K_IGNORE:
// Ignore mouse event or ex_window() result. // Ignore mouse event or open_cmdwin() result.
return command_line_not_changed(s); return command_line_not_changed(s);
@@ -6001,7 +6001,7 @@ int cmd_gchar(int offset)
* Ctrl_C if it is to be abandoned * Ctrl_C if it is to be abandoned
* K_IGNORE if editing continues * K_IGNORE if editing continues
*/ */
static int ex_window(void) static int open_cmdwin(void)
{ {
struct cmdline_info save_ccline; struct cmdline_info save_ccline;
bufref_T old_curbuf; bufref_T old_curbuf;
@@ -6034,6 +6034,7 @@ static int ex_window(void)
block_autocmds(); block_autocmds();
/* don't use a new tab page */ /* don't use a new tab page */
cmdmod.tab = 0; cmdmod.tab = 0;
cmdmod.noswapfile = 1;
/* Create a window for the command-line buffer. */ /* Create a window for the command-line buffer. */
if (win_split((int)p_cwh, WSP_BOT) == FAIL) { if (win_split((int)p_cwh, WSP_BOT) == FAIL) {

View File

@@ -5811,7 +5811,7 @@ void buf_copy_options(buf_T *buf, int flags)
buf->b_p_ml = p_ml; buf->b_p_ml = p_ml;
buf->b_p_ml_nobin = p_ml_nobin; buf->b_p_ml_nobin = p_ml_nobin;
buf->b_p_inf = p_inf; buf->b_p_inf = p_inf;
buf->b_p_swf = p_swf; buf->b_p_swf = cmdmod.noswapfile ? false : p_swf;
buf->b_p_cpt = vim_strsave(p_cpt); buf->b_p_cpt = vim_strsave(p_cpt);
buf->b_p_cfu = vim_strsave(p_cfu); buf->b_p_cfu = vim_strsave(p_cfu);
buf->b_p_ofu = vim_strsave(p_ofu); buf->b_p_ofu = vim_strsave(p_ofu);