summaryrefslogblamecommitdiffstats
path: root/patches/source/vim/patches/7.4.171
blob: cfd390690bab46837ee1a4127385143e618571b7 (plain) (tree)
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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841








































































































































































































































































































































































































































































































































































































































































































































































































































































                                                                                       
To: vim_dev@googlegroups.com
Subject: Patch 7.4.171
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4.171
Problem:    Redo does not set v:count and v:count1.
Solution:   Use a separate buffer for redo, so that we can set the counts when
	    performing redo.
Files:	    src/getchar.c, src/globals.h, src/normal.c, src/proto/getchar.pro,
	    src/structs.h


*** ../vim-7.4.170/src/getchar.c	2013-06-29 13:43:27.000000000 +0200
--- src/getchar.c	2014-02-11 14:54:46.830097259 +0100
***************
*** 40,52 ****
  
  #define MINIMAL_SIZE 20			/* minimal size for b_str */
  
! static struct buffheader redobuff = {{NULL, {NUL}}, NULL, 0, 0};
! static struct buffheader old_redobuff = {{NULL, {NUL}}, NULL, 0, 0};
  #if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO)
! static struct buffheader save_redobuff = {{NULL, {NUL}}, NULL, 0, 0};
! static struct buffheader save_old_redobuff = {{NULL, {NUL}}, NULL, 0, 0};
  #endif
! static struct buffheader recordbuff = {{NULL, {NUL}}, NULL, 0, 0};
  
  static int typeahead_char = 0;		/* typeahead char that's not flushed */
  
--- 40,52 ----
  
  #define MINIMAL_SIZE 20			/* minimal size for b_str */
  
! static buffheader_T redobuff = {{NULL, {NUL}}, NULL, 0, 0};
! static buffheader_T old_redobuff = {{NULL, {NUL}}, NULL, 0, 0};
  #if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO)
! static buffheader_T save_redobuff = {{NULL, {NUL}}, NULL, 0, 0};
! static buffheader_T save_old_redobuff = {{NULL, {NUL}}, NULL, 0, 0};
  #endif
! static buffheader_T recordbuff = {{NULL, {NUL}}, NULL, 0, 0};
  
  static int typeahead_char = 0;		/* typeahead char that's not flushed */
  
***************
*** 112,122 ****
  
  static int	last_recorded_len = 0;	/* number of last recorded chars */
  
! static char_u	*get_buffcont __ARGS((struct buffheader *, int));
! static void	add_buff __ARGS((struct buffheader *, char_u *, long n));
! static void	add_num_buff __ARGS((struct buffheader *, long));
! static void	add_char_buff __ARGS((struct buffheader *, int));
! static int	read_stuff __ARGS((int advance));
  static void	start_stuff __ARGS((void));
  static int	read_redo __ARGS((int, int));
  static void	copy_redo __ARGS((int));
--- 112,123 ----
  
  static int	last_recorded_len = 0;	/* number of last recorded chars */
  
! static char_u	*get_buffcont __ARGS((buffheader_T *, int));
! static void	add_buff __ARGS((buffheader_T *, char_u *, long n));
! static void	add_num_buff __ARGS((buffheader_T *, long));
! static void	add_char_buff __ARGS((buffheader_T *, int));
! static int	read_readbuffers __ARGS((int advance));
! static int	read_readbuf __ARGS((buffheader_T *buf, int advance));
  static void	start_stuff __ARGS((void));
  static int	read_redo __ARGS((int, int));
  static void	copy_redo __ARGS((int));
***************
*** 137,145 ****
   */
      void
  free_buff(buf)
!     struct buffheader	*buf;
  {
!     struct buffblock	*p, *np;
  
      for (p = buf->bh_first.b_next; p != NULL; p = np)
      {
--- 138,146 ----
   */
      void
  free_buff(buf)
!     buffheader_T	*buf;
  {
!     buffblock_T	*p, *np;
  
      for (p = buf->bh_first.b_next; p != NULL; p = np)
      {
***************
*** 155,168 ****
   */
      static char_u *
  get_buffcont(buffer, dozero)
!     struct buffheader	*buffer;
      int			dozero;	    /* count == zero is not an error */
  {
      long_u	    count = 0;
      char_u	    *p = NULL;
      char_u	    *p2;
      char_u	    *str;
!     struct buffblock *bp;
  
      /* compute the total length of the string */
      for (bp = buffer->bh_first.b_next; bp != NULL; bp = bp->b_next)
--- 156,169 ----
   */
      static char_u *
  get_buffcont(buffer, dozero)
!     buffheader_T	*buffer;
      int			dozero;	    /* count == zero is not an error */
  {
      long_u	    count = 0;
      char_u	    *p = NULL;
      char_u	    *p2;
      char_u	    *str;
!     buffblock_T *bp;
  
      /* compute the total length of the string */
      for (bp = buffer->bh_first.b_next; bp != NULL; bp = bp->b_next)
***************
*** 230,240 ****
   */
      static void
  add_buff(buf, s, slen)
!     struct buffheader	*buf;
      char_u		*s;
      long		slen;	/* length of "s" or -1 */
  {
!     struct buffblock *p;
      long_u	    len;
  
      if (slen < 0)
--- 231,241 ----
   */
      static void
  add_buff(buf, s, slen)
!     buffheader_T	*buf;
      char_u		*s;
      long		slen;	/* length of "s" or -1 */
  {
!     buffblock_T *p;
      long_u	    len;
  
      if (slen < 0)
***************
*** 270,276 ****
  	    len = MINIMAL_SIZE;
  	else
  	    len = slen;
! 	p = (struct buffblock *)lalloc((long_u)(sizeof(struct buffblock) + len),
  									TRUE);
  	if (p == NULL)
  	    return; /* no space, just forget it */
--- 271,277 ----
  	    len = MINIMAL_SIZE;
  	else
  	    len = slen;
! 	p = (buffblock_T *)lalloc((long_u)(sizeof(buffblock_T) + len),
  									TRUE);
  	if (p == NULL)
  	    return; /* no space, just forget it */
***************
*** 289,295 ****
   */
      static void
  add_num_buff(buf, n)
!     struct buffheader *buf;
      long	      n;
  {
      char_u	number[32];
--- 290,296 ----
   */
      static void
  add_num_buff(buf, n)
!     buffheader_T *buf;
      long	      n;
  {
      char_u	number[32];
***************
*** 304,310 ****
   */
      static void
  add_char_buff(buf, c)
!     struct buffheader	*buf;
      int			c;
  {
  #ifdef FEAT_MBYTE
--- 305,311 ----
   */
      static void
  add_char_buff(buf, c)
!     buffheader_T	*buf;
      int			c;
  {
  #ifdef FEAT_MBYTE
***************
*** 354,399 ****
  #endif
  }
  
  /*
!  * Get one byte from the stuff buffer.
   * If advance == TRUE go to the next char.
   * No translation is done K_SPECIAL and CSI are escaped.
   */
      static int
! read_stuff(advance)
      int		advance;
  {
!     char_u		c;
!     struct buffblock	*curr;
  
!     if (stuffbuff.bh_first.b_next == NULL)  /* buffer is empty */
  	return NUL;
  
!     curr = stuffbuff.bh_first.b_next;
!     c = curr->b_str[stuffbuff.bh_index];
  
      if (advance)
      {
! 	if (curr->b_str[++stuffbuff.bh_index] == NUL)
  	{
! 	    stuffbuff.bh_first.b_next = curr->b_next;
  	    vim_free(curr);
! 	    stuffbuff.bh_index = 0;
  	}
      }
      return c;
  }
  
  /*
!  * Prepare the stuff buffer for reading (if it contains something).
   */
      static void
  start_stuff()
  {
!     if (stuffbuff.bh_first.b_next != NULL)
      {
! 	stuffbuff.bh_curr = &(stuffbuff.bh_first);
! 	stuffbuff.bh_space = 0;
      }
  }
  
--- 355,425 ----
  #endif
  }
  
+ /* First read ahead buffer. Used for translated commands. */
+ static buffheader_T readbuf1 = {{NULL, {NUL}}, NULL, 0, 0};
+ 
+ /* Second read ahead buffer. Used for redo. */
+ static buffheader_T readbuf2 = {{NULL, {NUL}}, NULL, 0, 0};
+ 
  /*
!  * Get one byte from the read buffers.  Use readbuf1 one first, use readbuf2
!  * if that one is empty.
   * If advance == TRUE go to the next char.
   * No translation is done K_SPECIAL and CSI are escaped.
   */
      static int
! read_readbuffers(advance)
      int		advance;
  {
!     int c;
! 
!     c = read_readbuf(&readbuf1, advance);
!     if (c == NUL)
! 	c = read_readbuf(&readbuf2, advance);
!     return c;
! }
! 
!     static int
! read_readbuf(buf, advance)
!     buffheader_T    *buf;
!     int		    advance;
! {
!     char_u	c;
!     buffblock_T	*curr;
  
!     if (buf->bh_first.b_next == NULL)  /* buffer is empty */
  	return NUL;
  
!     curr = buf->bh_first.b_next;
!     c = curr->b_str[buf->bh_index];
  
      if (advance)
      {
! 	if (curr->b_str[++buf->bh_index] == NUL)
  	{
! 	    buf->bh_first.b_next = curr->b_next;
  	    vim_free(curr);
! 	    buf->bh_index = 0;
  	}
      }
      return c;
  }
  
  /*
!  * Prepare the read buffers for reading (if they contains something).
   */
      static void
  start_stuff()
  {
!     if (readbuf1.bh_first.b_next != NULL)
      {
! 	readbuf1.bh_curr = &(readbuf1.bh_first);
! 	readbuf1.bh_space = 0;
!     }
!     if (readbuf2.bh_first.b_next != NULL)
!     {
! 	readbuf2.bh_curr = &(readbuf2.bh_first);
! 	readbuf2.bh_space = 0;
      }
  }
  
***************
*** 403,409 ****
      int
  stuff_empty()
  {
!     return (stuffbuff.bh_first.b_next == NULL);
  }
  
  /*
--- 429,446 ----
      int
  stuff_empty()
  {
!     return (readbuf1.bh_first.b_next == NULL
! 	 && readbuf2.bh_first.b_next == NULL);
! }
! 
! /*
!  * Return TRUE if readbuf1 is empty.  There may still be redo characters in
!  * redbuf2.
!  */
!     int
! readbuf1_empty()
! {
!     return (readbuf1.bh_first.b_next == NULL);
  }
  
  /*
***************
*** 428,434 ****
      init_typebuf();
  
      start_stuff();
!     while (read_stuff(TRUE) != NUL)
  	;
  
      if (flush_typeahead)	    /* remove all typeahead */
--- 465,471 ----
      init_typebuf();
  
      start_stuff();
!     while (read_readbuffers(TRUE) != NUL)
  	;
  
      if (flush_typeahead)	    /* remove all typeahead */
***************
*** 483,489 ****
  	redobuff = old_redobuff;
  	old_redobuff.bh_first.b_next = NULL;
  	start_stuff();
! 	while (read_stuff(TRUE) != NUL)
  	    ;
      }
  }
--- 520,526 ----
  	redobuff = old_redobuff;
  	old_redobuff.bh_first.b_next = NULL;
  	start_stuff();
! 	while (read_readbuffers(TRUE) != NUL)
  	    ;
      }
  }
***************
*** 638,644 ****
  stuffReadbuff(s)
      char_u	*s;
  {
!     add_buff(&stuffbuff, s, -1L);
  }
  
      void
--- 675,681 ----
  stuffReadbuff(s)
      char_u	*s;
  {
!     add_buff(&readbuf1, s, -1L);
  }
  
      void
***************
*** 646,652 ****
      char_u	*s;
      long	len;
  {
!     add_buff(&stuffbuff, s, len);
  }
  
  #if defined(FEAT_EVAL) || defined(PROTO)
--- 683,689 ----
      char_u	*s;
      long	len;
  {
!     add_buff(&readbuf1, s, len);
  }
  
  #if defined(FEAT_EVAL) || defined(PROTO)
***************
*** 692,698 ****
  stuffcharReadbuff(c)
      int		   c;
  {
!     add_char_buff(&stuffbuff, c);
  }
  
  /*
--- 729,735 ----
  stuffcharReadbuff(c)
      int		   c;
  {
!     add_char_buff(&readbuf1, c);
  }
  
  /*
***************
*** 702,708 ****
  stuffnumReadbuff(n)
      long    n;
  {
!     add_num_buff(&stuffbuff, n);
  }
  
  /*
--- 739,745 ----
  stuffnumReadbuff(n)
      long    n;
  {
!     add_num_buff(&readbuf1, n);
  }
  
  /*
***************
*** 718,730 ****
      int		init;
      int		old_redo;
  {
!     static struct buffblock	*bp;
!     static char_u		*p;
!     int				c;
  #ifdef FEAT_MBYTE
!     int				n;
!     char_u			buf[MB_MAXBYTES + 1];
!     int				i;
  #endif
  
      if (init)
--- 755,767 ----
      int		init;
      int		old_redo;
  {
!     static buffblock_T	*bp;
!     static char_u	*p;
!     int			c;
  #ifdef FEAT_MBYTE
!     int			n;
!     char_u		buf[MB_MAXBYTES + 1];
!     int			i;
  #endif
  
      if (init)
***************
*** 795,805 ****
      int	    c;
  
      while ((c = read_redo(FALSE, old_redo)) != NUL)
! 	stuffcharReadbuff(c);
  }
  
  /*
!  * Stuff the redo buffer into the stuffbuff.
   * Insert the redo count into the command.
   * If "old_redo" is TRUE, the last but one command is repeated
   * instead of the last command (inserting text). This is used for
--- 832,842 ----
      int	    c;
  
      while ((c = read_redo(FALSE, old_redo)) != NUL)
! 	add_char_buff(&readbuf2, c);
  }
  
  /*
!  * Stuff the redo buffer into readbuf2.
   * Insert the redo count into the command.
   * If "old_redo" is TRUE, the last but one command is repeated
   * instead of the last command (inserting text). This is used for
***************
*** 823,835 ****
      /* copy the buffer name, if present */
      if (c == '"')
      {
! 	add_buff(&stuffbuff, (char_u *)"\"", 1L);
  	c = read_redo(FALSE, old_redo);
  
  	/* if a numbered buffer is used, increment the number */
  	if (c >= '1' && c < '9')
  	    ++c;
! 	add_char_buff(&stuffbuff, c);
  	c = read_redo(FALSE, old_redo);
      }
  
--- 860,872 ----
      /* copy the buffer name, if present */
      if (c == '"')
      {
! 	add_buff(&readbuf2, (char_u *)"\"", 1L);
  	c = read_redo(FALSE, old_redo);
  
  	/* if a numbered buffer is used, increment the number */
  	if (c >= '1' && c < '9')
  	    ++c;
! 	add_char_buff(&readbuf2, c);
  	c = read_redo(FALSE, old_redo);
      }
  
***************
*** 850,867 ****
      {
  	while (VIM_ISDIGIT(c))	/* skip "old" count */
  	    c = read_redo(FALSE, old_redo);
! 	add_num_buff(&stuffbuff, count);
      }
  
      /* copy from the redo buffer into the stuff buffer */
!     add_char_buff(&stuffbuff, c);
      copy_redo(old_redo);
      return OK;
  }
  
  /*
   * Repeat the last insert (R, o, O, a, A, i or I command) by stuffing
!  * the redo buffer into the stuffbuff.
   * return FAIL for failure, OK otherwise
   */
      int
--- 887,904 ----
      {
  	while (VIM_ISDIGIT(c))	/* skip "old" count */
  	    c = read_redo(FALSE, old_redo);
! 	add_num_buff(&readbuf2, count);
      }
  
      /* copy from the redo buffer into the stuff buffer */
!     add_char_buff(&readbuf2, c);
      copy_redo(old_redo);
      return OK;
  }
  
  /*
   * Repeat the last insert (R, o, O, a, A, i or I command) by stuffing
!  * the redo buffer into readbuf2.
   * return FAIL for failure, OK otherwise
   */
      int
***************
*** 879,885 ****
  	if (vim_strchr((char_u *)"AaIiRrOo", c) != NULL)
  	{
  	    if (c == 'O' || c == 'o')
! 		stuffReadbuff(NL_STR);
  	    break;
  	}
      }
--- 916,922 ----
  	if (vim_strchr((char_u *)"AaIiRrOo", c) != NULL)
  	{
  	    if (c == 'O' || c == 'o')
! 		add_buff(&readbuf2, NL_STR, -1L);
  	    break;
  	}
      }
***************
*** 1360,1367 ****
      tp->old_mod_mask = old_mod_mask;
      old_char = -1;
  
!     tp->save_stuffbuff = stuffbuff;
!     stuffbuff.bh_first.b_next = NULL;
  # ifdef USE_INPUT_BUF
      tp->save_inputbuf = get_input_buf();
  # endif
--- 1397,1406 ----
      tp->old_mod_mask = old_mod_mask;
      old_char = -1;
  
!     tp->save_readbuf1 = readbuf1;
!     readbuf1.bh_first.b_next = NULL;
!     tp->save_readbuf2 = readbuf2;
!     readbuf2.bh_first.b_next = NULL;
  # ifdef USE_INPUT_BUF
      tp->save_inputbuf = get_input_buf();
  # endif
***************
*** 1384,1391 ****
      old_char = tp->old_char;
      old_mod_mask = tp->old_mod_mask;
  
!     free_buff(&stuffbuff);
!     stuffbuff = tp->save_stuffbuff;
  # ifdef USE_INPUT_BUF
      set_input_buf(tp->save_inputbuf);
  # endif
--- 1423,1432 ----
      old_char = tp->old_char;
      old_mod_mask = tp->old_mod_mask;
  
!     free_buff(&readbuf1);
!     readbuf1 = tp->save_readbuf1;
!     free_buff(&readbuf2);
!     readbuf2 = tp->save_readbuf2;
  # ifdef USE_INPUT_BUF
      set_input_buf(tp->save_inputbuf);
  # endif
***************
*** 1992,1998 ****
  		typeahead_char = 0;
  	}
  	else
! 	    c = read_stuff(advance);
  	if (c != NUL && !got_int)
  	{
  	    if (advance)
--- 2033,2039 ----
  		typeahead_char = 0;
  	}
  	else
! 	    c = read_readbuffers(advance);
  	if (c != NUL && !got_int)
  	{
  	    if (advance)
*** ../vim-7.4.170/src/globals.h	2013-11-09 03:31:45.000000000 +0100
--- src/globals.h	2014-02-11 14:17:44.070063200 +0100
***************
*** 979,989 ****
  EXTERN int	readonlymode INIT(= FALSE); /* Set to TRUE for "view" */
  EXTERN int	recoverymode INIT(= FALSE); /* Set to TRUE for "-r" option */
  
- EXTERN struct buffheader stuffbuff	/* stuff buffer */
- #ifdef DO_INIT
- 		    = {{NULL, {NUL}}, NULL, 0, 0}
- #endif
- 		    ;
  EXTERN typebuf_T typebuf		/* typeahead buffer */
  #ifdef DO_INIT
  		    = {NULL, NULL, 0, 0, 0, 0, 0, 0, 0}
--- 979,984 ----
*** ../vim-7.4.170/src/normal.c	2014-01-14 13:18:53.000000000 +0100
--- src/normal.c	2014-02-11 14:53:54.246096453 +0100
***************
*** 655,662 ****
  #ifdef FEAT_EVAL
      /* Set v:count here, when called from main() and not a stuffed
       * command, so that v:count can be used in an expression mapping
!      * when there is no count. */
!     if (toplevel && stuff_empty())
  	set_vcount_ca(&ca, &set_prevcount);
  #endif
  
--- 655,662 ----
  #ifdef FEAT_EVAL
      /* Set v:count here, when called from main() and not a stuffed
       * command, so that v:count can be used in an expression mapping
!      * when there is no count. Do set it for redo. */
!     if (toplevel && readbuf1_empty())
  	set_vcount_ca(&ca, &set_prevcount);
  #endif
  
***************
*** 736,743 ****
  #ifdef FEAT_EVAL
  	    /* Set v:count here, when called from main() and not a stuffed
  	     * command, so that v:count can be used in an expression mapping
! 	     * right after the count. */
! 	    if (toplevel && stuff_empty())
  		set_vcount_ca(&ca, &set_prevcount);
  #endif
  	    if (ctrl_w)
--- 736,743 ----
  #ifdef FEAT_EVAL
  	    /* Set v:count here, when called from main() and not a stuffed
  	     * command, so that v:count can be used in an expression mapping
! 	     * right after the count. Do set it for redo. */
! 	    if (toplevel && readbuf1_empty())
  		set_vcount_ca(&ca, &set_prevcount);
  #endif
  	    if (ctrl_w)
***************
*** 819,826 ****
  #ifdef FEAT_EVAL
      /*
       * Only set v:count when called from main() and not a stuffed command.
       */
!     if (toplevel && stuff_empty())
  	set_vcount(ca.count0, ca.count1, set_prevcount);
  #endif
  
--- 819,827 ----
  #ifdef FEAT_EVAL
      /*
       * Only set v:count when called from main() and not a stuffed command.
+      * Do set it for redo.
       */
!     if (toplevel && readbuf1_empty())
  	set_vcount(ca.count0, ca.count1, set_prevcount);
  #endif
  
*** ../vim-7.4.170/src/proto/getchar.pro	2013-08-10 13:37:12.000000000 +0200
--- src/proto/getchar.pro	2014-02-11 14:55:14.806097687 +0100
***************
*** 1,8 ****
  /* getchar.c */
! void free_buff __ARGS((struct buffheader *buf));
  char_u *get_recorded __ARGS((void));
  char_u *get_inserted __ARGS((void));
  int stuff_empty __ARGS((void));
  void typeahead_noflush __ARGS((int c));
  void flush_buffers __ARGS((int flush_typeahead));
  void ResetRedobuff __ARGS((void));
--- 1,9 ----
  /* getchar.c */
! void free_buff __ARGS((buffheader_T *buf));
  char_u *get_recorded __ARGS((void));
  char_u *get_inserted __ARGS((void));
  int stuff_empty __ARGS((void));
+ int readbuf1_empty __ARGS((void));
  void typeahead_noflush __ARGS((int c));
  void flush_buffers __ARGS((int flush_typeahead));
  void ResetRedobuff __ARGS((void));
*** ../vim-7.4.170/src/structs.h	2013-11-12 04:43:57.000000000 +0100
--- src/structs.h	2014-02-11 14:35:43.606079741 +0100
***************
*** 471,483 ****
      blocknr_T	nt_new_bnum;		/* new, positive, number */
  };
  
  /*
   * structure used to store one block of the stuff/redo/recording buffers
   */
  struct buffblock
  {
!     struct buffblock	*b_next;	/* pointer to next buffblock */
!     char_u		b_str[1];	/* contents (actually longer) */
  };
  
  /*
--- 471,487 ----
      blocknr_T	nt_new_bnum;		/* new, positive, number */
  };
  
+ 
+ typedef struct buffblock buffblock_T;
+ typedef struct buffheader buffheader_T;
+ 
  /*
   * structure used to store one block of the stuff/redo/recording buffers
   */
  struct buffblock
  {
!     buffblock_T	*b_next;	/* pointer to next buffblock */
!     char_u	b_str[1];	/* contents (actually longer) */
  };
  
  /*
***************
*** 485,494 ****
   */
  struct buffheader
  {
!     struct buffblock	bh_first;	/* first (dummy) block of list */
!     struct buffblock	*bh_curr;	/* buffblock for appending */
!     int			bh_index;	/* index for reading */
!     int			bh_space;	/* space in bh_curr for appending */
  };
  
  /*
--- 489,498 ----
   */
  struct buffheader
  {
!     buffblock_T	bh_first;	/* first (dummy) block of list */
!     buffblock_T	*bh_curr;	/* buffblock for appending */
!     int		bh_index;	/* index for reading */
!     int		bh_space;	/* space in bh_curr for appending */
  };
  
  /*
***************
*** 964,970 ****
      int			typebuf_valid;	    /* TRUE when save_typebuf valid */
      int			old_char;
      int			old_mod_mask;
!     struct buffheader	save_stuffbuff;
  #ifdef USE_INPUT_BUF
      char_u		*save_inputbuf;
  #endif
--- 968,975 ----
      int			typebuf_valid;	    /* TRUE when save_typebuf valid */
      int			old_char;
      int			old_mod_mask;
!     buffheader_T	save_readbuf1;
!     buffheader_T	save_readbuf2;
  #ifdef USE_INPUT_BUF
      char_u		*save_inputbuf;
  #endif
*** ../vim-7.4.170/src/version.c	2014-02-11 12:15:39.781950970 +0100
--- src/version.c	2014-02-11 15:05:17.306106920 +0100
***************
*** 740,741 ****
--- 740,743 ----
  {   /* Add new patch number below this line */
+ /**/
+     171,
  /**/

-- 
Linux is just like a wigwam: no Windows, no Gates and an Apache inside.

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