Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

updated for version 7.3.429

Problem:    When 'cpoptions' includes "E" "c0" in the first column is an
	    error. The redo register is then set to the errornous command.
Solution:   Do not set the redo register if the command fails because of an
	    empty region. (Hideki Eiraku)
  • Loading branch information...
commit 849973b5c0a33f393e935813b63818c13e9702f0 1 parent 33000f0
Bram Moolenaar authored
24 src/getchar.c
@@ -470,6 +470,24 @@ ResetRedobuff()
470 470 }
471 471 }
472 472
  473 +/*
  474 + * Discard the contents of the redo buffer and restore the previous redo
  475 + * buffer.
  476 + */
  477 + void
  478 +CancelRedo()
  479 +{
  480 + if (!block_redo)
  481 + {
  482 + free_buff(&redobuff);
  483 + redobuff = old_redobuff;
  484 + old_redobuff.bh_first.b_next = NULL;
  485 + start_stuff();
  486 + while (read_stuff(TRUE) != NUL)
  487 + ;
  488 + }
  489 +}
  490 +
473 491 #if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO)
474 492 /*
475 493 * Save redobuff and old_redobuff to save_redobuff and save_old_redobuff.
@@ -691,9 +709,9 @@ stuffnumReadbuff(n)
691 709 * Read a character from the redo buffer. Translates K_SPECIAL, CSI and
692 710 * multibyte characters.
693 711 * The redo buffer is left as it is.
694   - * if init is TRUE, prepare for redo, return FAIL if nothing to redo, OK
695   - * otherwise
696   - * if old is TRUE, use old_redobuff instead of redobuff
  712 + * If init is TRUE, prepare for redo, return FAIL if nothing to redo, OK
  713 + * otherwise.
  714 + * If old is TRUE, use old_redobuff instead of redobuff.
697 715 */
698 716 static int
699 717 read_redo(init, old_redo)
18 src/normal.c
@@ -1978,7 +1978,10 @@ do_pending_operator(cap, old_col, gui_yank)
1978 1978 VIsual_reselect = FALSE; /* don't reselect now */
1979 1979 #endif
1980 1980 if (empty_region_error)
  1981 + {
1981 1982 vim_beep();
  1983 + CancelRedo();
  1984 + }
1982 1985 else
1983 1986 {
1984 1987 (void)op_delete(oap);
@@ -1992,7 +1995,10 @@ do_pending_operator(cap, old_col, gui_yank)
1992 1995 if (empty_region_error)
1993 1996 {
1994 1997 if (!gui_yank)
  1998 + {
1995 1999 vim_beep();
  2000 + CancelRedo();
  2001 + }
1996 2002 }
1997 2003 else
1998 2004 (void)op_yank(oap, FALSE, !gui_yank);
@@ -2004,7 +2010,10 @@ do_pending_operator(cap, old_col, gui_yank)
2004 2010 VIsual_reselect = FALSE; /* don't reselect now */
2005 2011 #endif
2006 2012 if (empty_region_error)
  2013 + {
2007 2014 vim_beep();
  2015 + CancelRedo();
  2016 + }
2008 2017 else
2009 2018 {
2010 2019 /* This is a new edit command, not a restart. Need to
@@ -2066,7 +2075,10 @@ do_pending_operator(cap, old_col, gui_yank)
2066 2075 case OP_LOWER:
2067 2076 case OP_ROT13:
2068 2077 if (empty_region_error)
  2078 + {
2069 2079 vim_beep();
  2080 + CancelRedo();
  2081 + }
2070 2082 else
2071 2083 op_tilde(oap);
2072 2084 check_cursor_col();
@@ -2099,7 +2111,10 @@ do_pending_operator(cap, old_col, gui_yank)
2099 2111 #endif
2100 2112 #ifdef FEAT_VISUALEXTRA
2101 2113 if (empty_region_error)
  2114 + {
2102 2115 vim_beep();
  2116 + CancelRedo();
  2117 + }
2103 2118 else
2104 2119 {
2105 2120 /* This is a new edit command, not a restart. Need to
@@ -2129,7 +2144,10 @@ do_pending_operator(cap, old_col, gui_yank)
2129 2144 #ifdef FEAT_VISUALEXTRA
2130 2145 if (empty_region_error)
2131 2146 #endif
  2147 + {
2132 2148 vim_beep();
  2149 + CancelRedo();
  2150 + }
2133 2151 #ifdef FEAT_VISUALEXTRA
2134 2152 else
2135 2153 op_replace(oap, cap->nchar);
3  src/proto/getchar.pro
@@ -4,8 +4,9 @@ char_u *get_recorded __ARGS((void));
4 4 char_u *get_inserted __ARGS((void));
5 5 int stuff_empty __ARGS((void));
6 6 void typeahead_noflush __ARGS((int c));
7   -void flush_buffers __ARGS((int typeahead));
  7 +void flush_buffers __ARGS((int flush_typeahead));
8 8 void ResetRedobuff __ARGS((void));
  9 +void CancelRedo __ARGS((void));
9 10 void saveRedobuff __ARGS((void));
10 11 void restoreRedobuff __ARGS((void));
11 12 void AppendToRedobuff __ARGS((char_u *s));
2  src/version.c
@@ -715,6 +715,8 @@ static char *(features[]) =
715 715 static int included_patches[] =
716 716 { /* Add new patch number below this line */
717 717 /**/
  718 + 429,
  719 +/**/
718 720 428,
719 721 /**/
720 722 427,

0 comments on commit 849973b

Please sign in to comment.
Something went wrong with that request. Please try again.