summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1192
blob: eeb06f6223564c56798a589e4f4641bac05f66a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1192
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

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 -- 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    ///