Skip to content

Commit

Permalink
patch 8.0.0546: swap file exists briefly when opening the command window
Browse files Browse the repository at this point in the history
Problem:    Swap file exists briefly when opening the command window.
Solution:   Set the noswapfile command modifier before splitting the window.
            (James McCoy, closes #1620)
  • Loading branch information
brammool committed Apr 7, 2017
1 parent 15ecbd6 commit 3bab939
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/ex_getln.c
Expand Up @@ -127,7 +127,7 @@ static void clear_hist_entry(histentry_T *hisptr);
#endif #endif


#ifdef FEAT_CMDWIN #ifdef FEAT_CMDWIN
static int ex_window(void); static int open_cmdwin(void);
#endif #endif


#if defined(FEAT_CMDL_COMPL) || defined(PROTO) #if defined(FEAT_CMDL_COMPL) || defined(PROTO)
Expand Down Expand Up @@ -773,7 +773,7 @@ getcmdline(
/* /*
* Open a window to edit the command line (and history). * Open a window to edit the command line (and history).
*/ */
c = ex_window(); c = open_cmdwin();
some_key_typed = TRUE; some_key_typed = TRUE;
} }
} }
Expand Down Expand Up @@ -1292,7 +1292,7 @@ getcmdline(
goto cmdline_not_changed; goto cmdline_not_changed;


case K_IGNORE: case K_IGNORE:
/* Ignore mouse event or ex_window() result. */ /* Ignore mouse event or open_cmdwin() result. */
goto cmdline_not_changed; goto cmdline_not_changed;


#ifdef FEAT_GUI_W32 #ifdef FEAT_GUI_W32
Expand Down Expand Up @@ -6796,7 +6796,7 @@ cmd_gchar(int offset)
* K_IGNORE if editing continues * K_IGNORE if editing continues
*/ */
static int static int
ex_window(void) open_cmdwin(void)
{ {
struct cmdline_info save_ccline; struct cmdline_info save_ccline;
bufref_T old_curbuf; bufref_T old_curbuf;
Expand Down Expand Up @@ -6841,6 +6841,7 @@ ex_window(void)
# endif # endif
/* 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)
Expand All @@ -6857,7 +6858,6 @@ ex_window(void)
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL); (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL);
(void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE); (void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE);
set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL); set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL);
set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
curbuf->b_p_ma = TRUE; curbuf->b_p_ma = TRUE;
#ifdef FEAT_FOLDING #ifdef FEAT_FOLDING
curwin->w_p_fen = FALSE; curwin->w_p_fen = FALSE;
Expand Down
2 changes: 1 addition & 1 deletion src/option.c
Expand Up @@ -11058,7 +11058,7 @@ 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;
#ifdef FEAT_INS_EXPAND #ifdef FEAT_INS_EXPAND
buf->b_p_cpt = vim_strsave(p_cpt); buf->b_p_cpt = vim_strsave(p_cpt);
#endif #endif
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -764,6 +764,8 @@ static char *(features[]) =


static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
546,
/**/ /**/
545, 545,
/**/ /**/
Expand Down

0 comments on commit 3bab939

Please sign in to comment.