summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0466
blob: 414d1073ed2ce420f6eb70462686319326144713 (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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0466
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.0466 (after 8.1.0463)
Problem:    Autocmd test fails.
Solution:   Do call inchar() when flushing typeahead.
Files:	    src/vim.h, src/getchar.c, src/proto/getchar.pro, src/memline.c,
            src/message.c, src/misc1.c


*** ../vim-8.1.0465/src/vim.h	2018-09-18 22:29:59.888041388 +0200
--- src/vim.h	2018-10-07 23:01:47.537604844 +0200
***************
*** 2108,2113 ****
--- 2108,2120 ----
      PASTE_ONE_CHAR	/* return first character */
  } paste_mode_T;
  
+ // Argument for flush_buffers().
+ typedef enum {
+     FLUSH_MINIMAL,
+     FLUSH_TYPEAHEAD,	// flush current typebuf contents
+     FLUSH_INPUT		// flush typebuf and inchar() input
+ } flush_buffers_T;
+ 
  #include "ex_cmds.h"	    /* Ex command defines */
  #include "spell.h"	    /* spell checking stuff */
  
*** ../vim-8.1.0465/src/getchar.c	2018-09-30 21:43:17.187693348 +0200
--- src/getchar.c	2018-10-07 23:05:48.079859873 +0200
***************
*** 438,444 ****
   * flush all typeahead characters (used when interrupted by a CTRL-C).
   */
      void
! flush_buffers(int flush_typeahead)
  {
      init_typebuf();
  
--- 438,444 ----
   * flush all typeahead characters (used when interrupted by a CTRL-C).
   */
      void
! flush_buffers(flush_buffers_T flush_typeahead)
  {
      init_typebuf();
  
***************
*** 446,460 ****
      while (read_readbuffers(TRUE) != NUL)
  	;
  
!     if (flush_typeahead)	    /* remove all typeahead */
      {
! 	/*
! 	 * We have to get all characters, because we may delete the first part
! 	 * of an escape sequence.
! 	 * In an xterm we get one char at a time and we have to get them all.
! 	 */
! 	while (inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 10L) != 0)
! 	    ;
  	typebuf.tb_off = MAXMAPLEN;
  	typebuf.tb_len = 0;
  #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL)
--- 446,466 ----
      while (read_readbuffers(TRUE) != NUL)
  	;
  
!     if (flush_typeahead == FLUSH_MINIMAL)
      {
! 	// remove mapped characters at the start only
! 	typebuf.tb_off += typebuf.tb_maplen;
! 	typebuf.tb_len -= typebuf.tb_maplen;
!     }
!     else
!     {
! 	// remove typeahead
! 	if (flush_typeahead == FLUSH_INPUT)
! 	    // We have to get all characters, because we may delete the first
! 	    // part of an escape sequence.  In an xterm we get one char at a
! 	    // time and we have to get them all.
! 	    while (inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 10L) != 0)
! 		;
  	typebuf.tb_off = MAXMAPLEN;
  	typebuf.tb_len = 0;
  #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL)
***************
*** 463,473 ****
  	typebuf_was_filled = FALSE;
  #endif
      }
-     else		    /* remove mapped characters at the start only */
-     {
- 	typebuf.tb_off += typebuf.tb_maplen;
- 	typebuf.tb_len -= typebuf.tb_maplen;
-     }
      typebuf.tb_maplen = 0;
      typebuf.tb_silent = 0;
      cmd_silent = FALSE;
--- 469,474 ----
***************
*** 1858,1863 ****
--- 1859,1865 ----
   * Check if a character is available, such that vgetc() will not block.
   * If the next character is a special character or multi-byte, the returned
   * character is not valid!.
+  * Returns NUL if no character is available.
   */
      int
  vpeekc(void)
***************
*** 1956,1962 ****
   *	KeyTyped is set to TRUE in the case the user typed the key.
   *	KeyStuffed is TRUE if the character comes from the stuff buffer.
   * if "advance" is FALSE (vpeekc()):
!  *	just look whether there is a character available.
   *
   * When "no_mapping" is zero, checks for mappings in the current mode.
   * Only returns one byte (of a multi-byte character).
--- 1958,1965 ----
   *	KeyTyped is set to TRUE in the case the user typed the key.
   *	KeyStuffed is TRUE if the character comes from the stuff buffer.
   * if "advance" is FALSE (vpeekc()):
!  *	Just look whether there is a character available.
!  *	Return NUL if not.
   *
   * When "no_mapping" is zero, checks for mappings in the current mode.
   * Only returns one byte (of a multi-byte character).
***************
*** 2084,2090 ****
  			c = ESC;
  		    else
  			c = Ctrl_C;
! 		    flush_buffers(TRUE);	/* flush all typeahead */
  
  		    if (advance)
  		    {
--- 2087,2093 ----
  			c = ESC;
  		    else
  			c = Ctrl_C;
! 		    flush_buffers(FLUSH_INPUT);	// flush all typeahead
  
  		    if (advance)
  		    {
***************
*** 2510,2516 ****
  				redrawcmdline();
  			    else
  				setcursor();
! 			    flush_buffers(FALSE);
  			    mapdepth = 0;	/* for next one */
  			    c = -1;
  			    break;
--- 2513,2519 ----
  				redrawcmdline();
  			    else
  				setcursor();
! 			    flush_buffers(FLUSH_MINIMAL);
  			    mapdepth = 0;	/* for next one */
  			    c = -1;
  			    break;
*** ../vim-8.1.0465/src/proto/getchar.pro	2018-05-17 13:52:36.000000000 +0200
--- src/proto/getchar.pro	2018-10-07 23:07:15.159189769 +0200
***************
*** 5,11 ****
  int stuff_empty(void);
  int readbuf1_empty(void);
  void typeahead_noflush(int c);
! void flush_buffers(int flush_typeahead);
  void ResetRedobuff(void);
  void CancelRedo(void);
  void saveRedobuff(save_redo_T *save_redo);
--- 5,11 ----
  int stuff_empty(void);
  int readbuf1_empty(void);
  void typeahead_noflush(int c);
! void flush_buffers(flush_buffers_T flush_typeahead);
  void ResetRedobuff(void);
  void CancelRedo(void);
  void saveRedobuff(save_redo_T *save_redo);
*** ../vim-8.1.0465/src/memline.c	2018-10-07 20:48:33.941433087 +0200
--- src/memline.c	2018-10-07 23:06:02.015753778 +0200
***************
*** 4522,4528 ****
  
  			// If vimrc has "simalt ~x" we don't want it to
  			// interfere with the prompt here.
! 			flush_buffers(TRUE);
  		    }
  
  #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
--- 4522,4528 ----
  
  			// If vimrc has "simalt ~x" we don't want it to
  			// interfere with the prompt here.
! 			flush_buffers(FLUSH_TYPEAHEAD);
  		    }
  
  #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
*** ../vim-8.1.0465/src/message.c	2018-09-30 21:43:17.195693290 +0200
--- src/message.c	2018-10-07 23:06:29.651542067 +0200
***************
*** 688,695 ****
  	if (p_eb)
  	    beep_flush();		/* also includes flush_buffers() */
  	else
! 	    flush_buffers(FALSE);	/* flush internal buffers */
! 	did_emsg = TRUE;		/* flag for DoOneCmd() */
  #ifdef FEAT_EVAL
  	did_uncaught_emsg = TRUE;
  #endif
--- 688,695 ----
  	if (p_eb)
  	    beep_flush();		/* also includes flush_buffers() */
  	else
! 	    flush_buffers(FLUSH_MINIMAL);  // flush internal buffers
! 	did_emsg = TRUE;		   // flag for DoOneCmd()
  #ifdef FEAT_EVAL
  	did_uncaught_emsg = TRUE;
  #endif
*** ../vim-8.1.0465/src/misc1.c	2018-09-30 21:43:17.195693290 +0200
--- src/misc1.c	2018-10-07 23:07:05.159267560 +0200
***************
*** 3825,3831 ****
  {
      if (emsg_silent == 0)
      {
! 	flush_buffers(FALSE);
  	vim_beep(BO_ERROR);
      }
  }
--- 3825,3831 ----
  {
      if (emsg_silent == 0)
      {
! 	flush_buffers(FLUSH_MINIMAL);
  	vim_beep(BO_ERROR);
      }
  }
*** ../vim-8.1.0465/src/version.c	2018-10-07 22:47:03.633199859 +0200
--- src/version.c	2018-10-07 23:04:59.372226904 +0200
***************
*** 794,795 ****
--- 794,797 ----
  {   /* Add new patch number below this line */
+ /**/
+     466,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
174. You know what a listserv is.

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