1
0
forked from aniani/vim

patch 8.0.0468: after aborting an Ex command g< does not work

Problem:    After aborting an Ex command g< does not work. (Marcin
            Szamotulski)
Solution:   Postpone clearing scrollback messages to until the command line
            has been entered.  Also fix that the screen isn't redrawn if after
            g< the command line is cancelled.
This commit is contained in:
Bram Moolenaar
2017-03-16 19:58:25 +01:00
parent 57002ad70c
commit f2405ed232
6 changed files with 61 additions and 16 deletions

View File

@@ -258,6 +258,7 @@ getcmdline(
return NULL; /* out of memory */ return NULL; /* out of memory */
ccline.cmdlen = ccline.cmdpos = 0; ccline.cmdlen = ccline.cmdpos = 0;
ccline.cmdbuff[0] = NUL; ccline.cmdbuff[0] = NUL;
sb_text_start_cmdline();
/* autoindent for :insert and :append */ /* autoindent for :insert and :append */
if (firstc <= 0) if (firstc <= 0)
@@ -2083,6 +2084,7 @@ returncmd:
#ifdef CURSOR_SHAPE #ifdef CURSOR_SHAPE
ui_cursor_shape(); /* may show different cursor shape */ ui_cursor_shape(); /* may show different cursor shape */
#endif #endif
sb_text_end_cmdline();
{ {
char_u *p = ccline.cmdbuff; char_u *p = ccline.cmdbuff;

View File

@@ -630,7 +630,7 @@ gui_init(void)
* where Vim was started. */ * where Vim was started. */
emsg_on_display = FALSE; emsg_on_display = FALSE;
msg_scrolled = 0; msg_scrolled = 0;
clear_sb_text(); clear_sb_text(TRUE);
need_wait_return = FALSE; need_wait_return = FALSE;
msg_didany = FALSE; msg_didany = FALSE;

View File

@@ -2146,8 +2146,6 @@ msg_puts_display(
inc_msg_scrolled(); inc_msg_scrolled();
need_wait_return = TRUE; /* may need wait_return in main() */ need_wait_return = TRUE; /* may need wait_return in main() */
if (must_redraw < VALID)
must_redraw = VALID;
redraw_cmdline = TRUE; redraw_cmdline = TRUE;
if (cmdline_row > 0 && !exmode_active) if (cmdline_row > 0 && !exmode_active)
--cmdline_row; --cmdline_row;
@@ -2367,6 +2365,8 @@ inc_msg_scrolled(void)
} }
#endif #endif
++msg_scrolled; ++msg_scrolled;
if (must_redraw < VALID)
must_redraw = VALID;
} }
/* /*
@@ -2389,7 +2389,15 @@ static msgchunk_T *last_msgchunk = NULL; /* last displayed text */
static msgchunk_T *msg_sb_start(msgchunk_T *mps); static msgchunk_T *msg_sb_start(msgchunk_T *mps);
static msgchunk_T *disp_sb_line(int row, msgchunk_T *smp); static msgchunk_T *disp_sb_line(int row, msgchunk_T *smp);
static int do_clear_sb_text = FALSE; /* clear text on next msg */ typedef enum {
SB_CLEAR_NONE = 0,
SB_CLEAR_ALL,
SB_CLEAR_CMDLINE_BUSY,
SB_CLEAR_CMDLINE_DONE
} sb_clear_T;
/* When to clear text on next msg. */
static sb_clear_T do_clear_sb_text = SB_CLEAR_NONE;
/* /*
* Store part of a printed message for displaying when scrolling back. * Store part of a printed message for displaying when scrolling back.
@@ -2404,10 +2412,11 @@ store_sb_text(
{ {
msgchunk_T *mp; msgchunk_T *mp;
if (do_clear_sb_text) if (do_clear_sb_text == SB_CLEAR_ALL
|| do_clear_sb_text == SB_CLEAR_CMDLINE_DONE)
{ {
clear_sb_text(); clear_sb_text(do_clear_sb_text == SB_CLEAR_ALL);
do_clear_sb_text = FALSE; do_clear_sb_text = SB_CLEAR_NONE;
} }
if (s > *sb_str) if (s > *sb_str)
@@ -2447,23 +2456,53 @@ store_sb_text(
void void
may_clear_sb_text(void) may_clear_sb_text(void)
{ {
do_clear_sb_text = TRUE; do_clear_sb_text = SB_CLEAR_ALL;
}
/*
* Starting to edit the command line, do not clear messages now.
*/
void
sb_text_start_cmdline(void)
{
do_clear_sb_text = SB_CLEAR_CMDLINE_BUSY;
msg_sb_eol();
}
/*
* Ending to edit the command line. Clear old lines but the last one later.
*/
void
sb_text_end_cmdline(void)
{
do_clear_sb_text = SB_CLEAR_CMDLINE_DONE;
} }
/* /*
* Clear any text remembered for scrolling back. * Clear any text remembered for scrolling back.
* When "all" is FALSE keep the last line.
* Called when redrawing the screen. * Called when redrawing the screen.
*/ */
void void
clear_sb_text(void) clear_sb_text(int all)
{ {
msgchunk_T *mp; msgchunk_T *mp;
msgchunk_T **lastp;
while (last_msgchunk != NULL) if (all)
lastp = &last_msgchunk;
else
{ {
mp = last_msgchunk->sb_prev; if (last_msgchunk == NULL)
vim_free(last_msgchunk); return;
last_msgchunk = mp; lastp = &last_msgchunk->sb_prev;
}
while (*lastp != NULL)
{
mp = (*lastp)->sb_prev;
vim_free(*lastp);
*lastp = mp;
} }
} }

View File

@@ -970,7 +970,7 @@ lalloc(long_u size, int message)
break; break;
releasing = TRUE; releasing = TRUE;
clear_sb_text(); /* free any scrollback text */ clear_sb_text(TRUE); /* free any scrollback text */
try_again = mf_release_all(); /* release as many blocks as possible */ try_again = mf_release_all(); /* release as many blocks as possible */
releasing = FALSE; releasing = FALSE;
@@ -1148,7 +1148,7 @@ free_all_mem(void)
# ifdef FEAT_DIFF # ifdef FEAT_DIFF
diff_clear(curtab); diff_clear(curtab);
# endif # endif
clear_sb_text(); /* free any scrollback text */ clear_sb_text(TRUE); /* free any scrollback text */
/* Free some global vars. */ /* Free some global vars. */
vim_free(username); vim_free(username);

View File

@@ -52,7 +52,9 @@ void msg_puts_long_len_attr(char_u *longstr, int len, int attr);
void msg_puts_attr(char_u *s, int attr); void msg_puts_attr(char_u *s, int attr);
int message_filtered(char_u *msg); int message_filtered(char_u *msg);
void may_clear_sb_text(void); void may_clear_sb_text(void);
void clear_sb_text(void); void sb_text_start_cmdline(void);
void sb_text_end_cmdline(void);
void clear_sb_text(int all);
void show_sb_text(void); void show_sb_text(void);
void msg_sb_eol(void); void msg_sb_eol(void);
int msg_use_printf(void); int msg_use_printf(void);

View File

@@ -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 */
/**/
468,
/**/ /**/
467, 467,
/**/ /**/