Patch 8.1.1192
Problem: Mode is not cleared when leaving Insert mode with mapped Esc.
Solution: Clear the mode when redraw_cmdline is set. (closes #4269)
Files: src/globals.h, src/screen.c, src/testdir/test_messages.vim
*** ../vim-8.1.1191/src/globals.h 2019-04-07 11:56:14.913845511 +0200
--- src/globals.h 2019-04-20 23:27:12.141239823 +0200
***************
*** 90,101 ****
*/
EXTERN int cmdline_row;
! EXTERN int redraw_cmdline INIT(= FALSE); /* cmdline must be redrawn */
! EXTERN int clear_cmdline INIT(= FALSE); /* cmdline must be cleared */
! EXTERN int mode_displayed INIT(= FALSE); /* mode is being displayed */
! EXTERN int no_win_do_lines_ins INIT(= FALSE); /* don't insert lines */
#if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
! EXTERN int cmdline_star INIT(= FALSE); /* cmdline is crypted */
#endif
EXTERN int exec_from_reg INIT(= FALSE); /* executing register */
--- 90,102 ----
*/
EXTERN int cmdline_row;
! EXTERN int redraw_cmdline INIT(= FALSE); // cmdline must be redrawn
! EXTERN int redraw_mode INIT(= FALSE); // mode must be redrawn
! EXTERN int clear_cmdline INIT(= FALSE); // cmdline must be cleared
! EXTERN int mode_displayed INIT(= FALSE); // mode is being displayed
! EXTERN int no_win_do_lines_ins INIT(= FALSE); // don't insert lines
#if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
! EXTERN int cmdline_star INIT(= FALSE); // cmdline is crypted
#endif
EXTERN int exec_from_reg INIT(= FALSE); /* executing register */
*** ../vim-8.1.1191/src/screen.c 2019-04-13 14:53:10.886456655 +0200
--- src/screen.c 2019-04-20 23:31:48.879644412 +0200
***************
*** 790,796 ****
/* Clear or redraw the command line. Done last, because scrolling may
* mess up the command line. */
! if (clear_cmdline || redraw_cmdline)
showmode();
if (no_update)
--- 790,796 ----
/* Clear or redraw the command line. Done last, because scrolling may
* mess up the command line. */
! if (clear_cmdline || redraw_cmdline || redraw_mode)
showmode();
if (no_update)
***************
*** 857,863 ****
static void
update_finish(void)
{
! if (redraw_cmdline)
showmode();
# ifdef FEAT_SEARCH_EXTRA
--- 857,863 ----
static void
update_finish(void)
{
! if (redraw_cmdline || redraw_mode)
showmode();
# ifdef FEAT_SEARCH_EXTRA
***************
*** 10128,10134 ****
|| !redrawing()
|| (char_avail() && !KeyTyped))
{
! redraw_cmdline = TRUE; // show mode later
return TRUE;
}
return FALSE;
--- 10128,10134 ----
|| !redrawing()
|| (char_avail() && !KeyTyped))
{
! redraw_mode = TRUE; // show mode later
return TRUE;
}
return FALSE;
***************
*** 10140,10145 ****
--- 10140,10146 ----
* If clear_cmdline is TRUE, clear the rest of the cmdline.
* If clear_cmdline is FALSE there may be a message there that needs to be
* cleared only if a mode is shown.
+ * If redraw_mode is TRUE show or clear the mode.
* Return the length of the message (0 if no message).
*/
int
***************
*** 10313,10319 ****
}
mode_displayed = TRUE;
! if (need_clear || clear_cmdline)
msg_clr_eos();
msg_didout = FALSE; /* overwrite this message */
length = msg_col;
--- 10314,10320 ----
}
mode_displayed = TRUE;
! if (need_clear || clear_cmdline || redraw_mode)
msg_clr_eos();
msg_didout = FALSE; /* overwrite this message */
length = msg_col;
***************
*** 10323,10328 ****
--- 10324,10334 ----
else if (clear_cmdline && msg_silent == 0)
/* Clear the whole command line. Will reset "clear_cmdline". */
msg_clr_cmdline();
+ else if (redraw_mode)
+ {
+ msg_pos_mode();
+ msg_clr_eos();
+ }
#ifdef FEAT_CMDL_INFO
/* In Visual mode the size of the selected area must be redrawn. */
***************
*** 10335,10340 ****
--- 10341,10347 ----
win_redr_ruler(lastwin, TRUE, FALSE);
#endif
redraw_cmdline = FALSE;
+ redraw_mode = FALSE;
clear_cmdline = FALSE;
return length;
*** ../vim-8.1.1191/src/testdir/test_messages.vim 2019-04-20
15:10:06.382607095 +0200
--- src/testdir/test_messages.vim 2019-04-20 22:59:32.707021358 +0200
***************
*** 125,127 ****
--- 125,155 ----
exe buf . 'bwipe!'
call delete(testfile)
endfunc
+
+ func Test_mode_message_at_leaving_insert_with_esc_mapped()
+ if !has('terminal') || has('gui_running')
+ return
+ endif
+
+ " Set custom statusline built by user-defined function.
+ let testfile = 'Xtest.vim'
+ call writefile([
+ \ 'set laststatus=2',
+ \ 'inoremap <Esc> <Esc>00',
+ \ ], testfile)
+
+ let rows = 10
+ let buf = term_start([GetVimProg(), '--clean', '-S', testfile],
{'term_rows': rows})
+ call term_wait(buf, 200)
+ call assert_equal('run', job_status(term_getjob(buf)))
+
+ call term_sendkeys(buf, "i")
+ call WaitForAssert({-> assert_match('^-- INSERT --\s*$', term_getline(buf,
rows))})
+ call term_sendkeys(buf, "\<Esc>")
+ call WaitForAssert({-> assert_match('^\s*$', term_getline(buf, rows))})
+
+ call term_sendkeys(buf, ":qall!\<CR>")
+ call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))})
+ exe buf . 'bwipe!'
+ call delete(testfile)
+ endfunc
*** ../vim-8.1.1191/src/version.c 2019-04-20 22:28:38.961420148 +0200
--- src/version.c 2019-04-20 23:36:50.069917005 +0200
***************
*** 773,774 ****
--- 773,776 ----
{ /* Add new patch number below this line */
+ /**/
+ 1192,
/**/
--
ARTHUR: Who are you?
TALL KNIGHT: We are the Knights Who Say "Ni"!
BEDEVERE: No! Not the Knights Who Say "Ni"!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.