To: vim_dev@googlegroups.com Subject: Patch 8.0.0468 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0468 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. Files: src/message.c, src/proto/message.pro, src/ex_getln.c, src/misc2.c, src/gui.c *** ../vim-8.0.0467/src/message.c 2017-03-16 17:23:26.827815840 +0100 --- src/message.c 2017-03-16 19:52:22.070812779 +0100 *************** *** 2146,2153 **** inc_msg_scrolled(); need_wait_return = TRUE; /* may need wait_return in main() */ - if (must_redraw < VALID) - must_redraw = VALID; redraw_cmdline = TRUE; if (cmdline_row > 0 && !exmode_active) --cmdline_row; --- 2146,2151 ---- *************** *** 2367,2372 **** --- 2365,2372 ---- } #endif ++msg_scrolled; + if (must_redraw < VALID) + must_redraw = VALID; } /* *************** *** 2389,2395 **** static msgchunk_T *msg_sb_start(msgchunk_T *mps); static msgchunk_T *disp_sb_line(int row, msgchunk_T *smp); ! static int do_clear_sb_text = FALSE; /* clear text on next msg */ /* * Store part of a printed message for displaying when scrolling back. --- 2389,2403 ---- static msgchunk_T *msg_sb_start(msgchunk_T *mps); static msgchunk_T *disp_sb_line(int row, msgchunk_T *smp); ! 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. *************** *** 2404,2413 **** { msgchunk_T *mp; ! if (do_clear_sb_text) { ! clear_sb_text(); ! do_clear_sb_text = FALSE; } if (s > *sb_str) --- 2412,2422 ---- { msgchunk_T *mp; ! if (do_clear_sb_text == SB_CLEAR_ALL ! || do_clear_sb_text == SB_CLEAR_CMDLINE_DONE) { ! clear_sb_text(do_clear_sb_text == SB_CLEAR_ALL); ! do_clear_sb_text = SB_CLEAR_NONE; } if (s > *sb_str) *************** *** 2447,2469 **** void may_clear_sb_text(void) { ! do_clear_sb_text = TRUE; } /* * Clear any text remembered for scrolling back. * Called when redrawing the screen. */ void ! clear_sb_text(void) { msgchunk_T *mp; ! while (last_msgchunk != NULL) { ! mp = last_msgchunk->sb_prev; ! vim_free(last_msgchunk); ! last_msgchunk = mp; } } --- 2456,2508 ---- void may_clear_sb_text(void) { ! 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. + * When "all" is FALSE keep the last line. * Called when redrawing the screen. */ void ! clear_sb_text(int all) { msgchunk_T *mp; + msgchunk_T **lastp; + + if (all) + lastp = &last_msgchunk; + else + { + if (last_msgchunk == NULL) + return; + lastp = &last_msgchunk->sb_prev; + } ! while (*lastp != NULL) { ! mp = (*lastp)->sb_prev; ! vim_free(*lastp); ! *lastp = mp; } } *** ../vim-8.0.0467/src/proto/message.pro 2017-03-01 15:07:01.337622045 +0100 --- src/proto/message.pro 2017-03-16 19:30:23.568273613 +0100 *************** *** 52,58 **** void msg_puts_attr(char_u *s, int attr); int message_filtered(char_u *msg); void may_clear_sb_text(void); ! void clear_sb_text(void); void show_sb_text(void); void msg_sb_eol(void); int msg_use_printf(void); --- 52,60 ---- void msg_puts_attr(char_u *s, int attr); int message_filtered(char_u *msg); void may_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 msg_sb_eol(void); int msg_use_printf(void); *** ../vim-8.0.0467/src/ex_getln.c 2017-03-16 17:23:26.819815897 +0100 --- src/ex_getln.c 2017-03-16 19:23:12.683362213 +0100 *************** *** 258,263 **** --- 258,264 ---- return NULL; /* out of memory */ ccline.cmdlen = ccline.cmdpos = 0; ccline.cmdbuff[0] = NUL; + sb_text_start_cmdline(); /* autoindent for :insert and :append */ if (firstc <= 0) *************** *** 2083,2088 **** --- 2084,2090 ---- #ifdef CURSOR_SHAPE ui_cursor_shape(); /* may show different cursor shape */ #endif + sb_text_end_cmdline(); { char_u *p = ccline.cmdbuff; *** ../vim-8.0.0467/src/misc2.c 2017-03-16 12:22:34.607343466 +0100 --- src/misc2.c 2017-03-16 19:30:07.200391008 +0100 *************** *** 970,976 **** break; releasing = TRUE; ! clear_sb_text(); /* free any scrollback text */ try_again = mf_release_all(); /* release as many blocks as possible */ releasing = FALSE; --- 970,976 ---- break; releasing = TRUE; ! clear_sb_text(TRUE); /* free any scrollback text */ try_again = mf_release_all(); /* release as many blocks as possible */ releasing = FALSE; *************** *** 1148,1154 **** # ifdef FEAT_DIFF diff_clear(curtab); # endif ! clear_sb_text(); /* free any scrollback text */ /* Free some global vars. */ vim_free(username); --- 1148,1154 ---- # ifdef FEAT_DIFF diff_clear(curtab); # endif ! clear_sb_text(TRUE); /* free any scrollback text */ /* Free some global vars. */ vim_free(username); *** ../vim-8.0.0467/src/gui.c 2017-03-12 20:09:59.472468347 +0100 --- src/gui.c 2017-03-16 19:25:08.930529331 +0100 *************** *** 630,636 **** * where Vim was started. */ emsg_on_display = FALSE; msg_scrolled = 0; ! clear_sb_text(); need_wait_return = FALSE; msg_didany = FALSE; --- 630,636 ---- * where Vim was started. */ emsg_on_display = FALSE; msg_scrolled = 0; ! clear_sb_text(TRUE); need_wait_return = FALSE; msg_didany = FALSE; *** ../vim-8.0.0467/src/version.c 2017-03-16 19:04:15.271616151 +0100 --- src/version.c 2017-03-16 19:55:52.261307187 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 468, /**/ -- hundred-and-one symptoms of being an internet addict: 134. You consider bandwidth to be more important than carats. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///