Karsten Hopp 60da82
To: vim_dev@googlegroups.com
Karsten Hopp 60da82
Subject: Patch 7.3.429
Karsten Hopp 60da82
Fcc: outbox
Karsten Hopp 60da82
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 60da82
Mime-Version: 1.0
Karsten Hopp 60da82
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 60da82
Content-Transfer-Encoding: 8bit
Karsten Hopp 60da82
------------
Karsten Hopp 60da82
Karsten Hopp 60da82
Patch 7.3.429
Karsten Hopp 60da82
Problem:    When 'cpoptions' includes "E" "c0" in the first column is an
Karsten Hopp 60da82
            error. The redo register is then set to the errornous command.
Karsten Hopp 60da82
Solution:   Do not set the redo register if the command fails because of an
Karsten Hopp 60da82
            empty region. (Hideki Eiraku)
Karsten Hopp 60da82
Files:      src/getchar.c, src/normal.c, src/proto/getchar.pro
Karsten Hopp 60da82
Karsten Hopp 60da82
Karsten Hopp 60da82
*** ../vim-7.3.428/src/getchar.c	2012-01-10 22:26:12.000000000 +0100
Karsten Hopp 60da82
--- src/getchar.c	2012-02-05 01:05:09.000000000 +0100
Karsten Hopp 60da82
***************
Karsten Hopp 60da82
*** 470,475 ****
Karsten Hopp 60da82
--- 470,493 ----
Karsten Hopp 60da82
      }
Karsten Hopp 60da82
  }
Karsten Hopp 60da82
  
Karsten Hopp 60da82
+ /*
Karsten Hopp 60da82
+  * Discard the contents of the redo buffer and restore the previous redo
Karsten Hopp 60da82
+  * buffer.
Karsten Hopp 60da82
+  */
Karsten Hopp 60da82
+     void
Karsten Hopp 60da82
+ CancelRedo()
Karsten Hopp 60da82
+ {
Karsten Hopp 60da82
+     if (!block_redo)
Karsten Hopp 60da82
+     {
Karsten Hopp 60da82
+ 	free_buff(&redobuff);
Karsten Hopp 60da82
+ 	redobuff = old_redobuff;
Karsten Hopp 60da82
+ 	old_redobuff.bh_first.b_next = NULL;
Karsten Hopp 60da82
+ 	start_stuff();
Karsten Hopp 60da82
+ 	while (read_stuff(TRUE) != NUL)
Karsten Hopp 60da82
+ 	    ;
Karsten Hopp 60da82
+     }
Karsten Hopp 60da82
+ }
Karsten Hopp 60da82
+ 
Karsten Hopp 60da82
  #if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO)
Karsten Hopp 60da82
  /*
Karsten Hopp 60da82
   * Save redobuff and old_redobuff to save_redobuff and save_old_redobuff.
Karsten Hopp 60da82
***************
Karsten Hopp 60da82
*** 691,699 ****
Karsten Hopp 60da82
   * Read a character from the redo buffer.  Translates K_SPECIAL, CSI and
Karsten Hopp 60da82
   * multibyte characters.
Karsten Hopp 60da82
   * The redo buffer is left as it is.
Karsten Hopp 60da82
!  * if init is TRUE, prepare for redo, return FAIL if nothing to redo, OK
Karsten Hopp 60da82
!  * otherwise
Karsten Hopp 60da82
!  * if old is TRUE, use old_redobuff instead of redobuff
Karsten Hopp 60da82
   */
Karsten Hopp 60da82
      static int
Karsten Hopp 60da82
  read_redo(init, old_redo)
Karsten Hopp 60da82
--- 709,717 ----
Karsten Hopp 60da82
   * Read a character from the redo buffer.  Translates K_SPECIAL, CSI and
Karsten Hopp 60da82
   * multibyte characters.
Karsten Hopp 60da82
   * The redo buffer is left as it is.
Karsten Hopp 60da82
!  * If init is TRUE, prepare for redo, return FAIL if nothing to redo, OK
Karsten Hopp 60da82
!  * otherwise.
Karsten Hopp 60da82
!  * If old is TRUE, use old_redobuff instead of redobuff.
Karsten Hopp 60da82
   */
Karsten Hopp 60da82
      static int
Karsten Hopp 60da82
  read_redo(init, old_redo)
Karsten Hopp 60da82
*** ../vim-7.3.428/src/normal.c	2012-01-26 11:43:04.000000000 +0100
Karsten Hopp 60da82
--- src/normal.c	2012-02-05 01:06:01.000000000 +0100
Karsten Hopp 60da82
***************
Karsten Hopp 60da82
*** 1978,1984 ****
Karsten Hopp 60da82
--- 1978,1987 ----
Karsten Hopp 60da82
  	    VIsual_reselect = FALSE;	    /* don't reselect now */
Karsten Hopp 60da82
  #endif
Karsten Hopp 60da82
  	    if (empty_region_error)
Karsten Hopp 60da82
+ 	    {
Karsten Hopp 60da82
  		vim_beep();
Karsten Hopp 60da82
+ 		CancelRedo();
Karsten Hopp 60da82
+ 	    }
Karsten Hopp 60da82
  	    else
Karsten Hopp 60da82
  	    {
Karsten Hopp 60da82
  		(void)op_delete(oap);
Karsten Hopp 60da82
***************
Karsten Hopp 60da82
*** 1992,1998 ****
Karsten Hopp 60da82
--- 1995,2004 ----
Karsten Hopp 60da82
  	    if (empty_region_error)
Karsten Hopp 60da82
  	    {
Karsten Hopp 60da82
  		if (!gui_yank)
Karsten Hopp 60da82
+ 		{
Karsten Hopp 60da82
  		    vim_beep();
Karsten Hopp 60da82
+ 		    CancelRedo();
Karsten Hopp 60da82
+ 		}
Karsten Hopp 60da82
  	    }
Karsten Hopp 60da82
  	    else
Karsten Hopp 60da82
  		(void)op_yank(oap, FALSE, !gui_yank);
Karsten Hopp 60da82
***************
Karsten Hopp 60da82
*** 2004,2010 ****
Karsten Hopp 60da82
--- 2010,2019 ----
Karsten Hopp 60da82
  	    VIsual_reselect = FALSE;	    /* don't reselect now */
Karsten Hopp 60da82
  #endif
Karsten Hopp 60da82
  	    if (empty_region_error)
Karsten Hopp 60da82
+ 	    {
Karsten Hopp 60da82
  		vim_beep();
Karsten Hopp 60da82
+ 		CancelRedo();
Karsten Hopp 60da82
+ 	    }
Karsten Hopp 60da82
  	    else
Karsten Hopp 60da82
  	    {
Karsten Hopp 60da82
  		/* This is a new edit command, not a restart.  Need to
Karsten Hopp 60da82
***************
Karsten Hopp 60da82
*** 2066,2072 ****
Karsten Hopp 60da82
--- 2075,2084 ----
Karsten Hopp 60da82
  	case OP_LOWER:
Karsten Hopp 60da82
  	case OP_ROT13:
Karsten Hopp 60da82
  	    if (empty_region_error)
Karsten Hopp 60da82
+ 	    {
Karsten Hopp 60da82
  		vim_beep();
Karsten Hopp 60da82
+ 		CancelRedo();
Karsten Hopp 60da82
+ 	    }
Karsten Hopp 60da82
  	    else
Karsten Hopp 60da82
  		op_tilde(oap);
Karsten Hopp 60da82
  	    check_cursor_col();
Karsten Hopp 60da82
***************
Karsten Hopp 60da82
*** 2099,2105 ****
Karsten Hopp 60da82
--- 2111,2120 ----
Karsten Hopp 60da82
  #endif
Karsten Hopp 60da82
  #ifdef FEAT_VISUALEXTRA
Karsten Hopp 60da82
  	    if (empty_region_error)
Karsten Hopp 60da82
+ 	    {
Karsten Hopp 60da82
  		vim_beep();
Karsten Hopp 60da82
+ 		CancelRedo();
Karsten Hopp 60da82
+ 	    }
Karsten Hopp 60da82
  	    else
Karsten Hopp 60da82
  	    {
Karsten Hopp 60da82
  		/* This is a new edit command, not a restart.  Need to
Karsten Hopp 60da82
***************
Karsten Hopp 60da82
*** 2129,2135 ****
Karsten Hopp 60da82
--- 2144,2153 ----
Karsten Hopp 60da82
  #ifdef FEAT_VISUALEXTRA
Karsten Hopp 60da82
  	    if (empty_region_error)
Karsten Hopp 60da82
  #endif
Karsten Hopp 60da82
+ 	    {
Karsten Hopp 60da82
  		vim_beep();
Karsten Hopp 60da82
+ 		CancelRedo();
Karsten Hopp 60da82
+ 	    }
Karsten Hopp 60da82
  #ifdef FEAT_VISUALEXTRA
Karsten Hopp 60da82
  	    else
Karsten Hopp 60da82
  		op_replace(oap, cap->nchar);
Karsten Hopp 60da82
*** ../vim-7.3.428/src/proto/getchar.pro	2010-10-20 21:22:17.000000000 +0200
Karsten Hopp 60da82
--- src/proto/getchar.pro	2012-02-05 01:05:20.000000000 +0100
Karsten Hopp 60da82
***************
Karsten Hopp 60da82
*** 4,11 ****
Karsten Hopp 60da82
  char_u *get_inserted __ARGS((void));
Karsten Hopp 60da82
  int stuff_empty __ARGS((void));
Karsten Hopp 60da82
  void typeahead_noflush __ARGS((int c));
Karsten Hopp 60da82
! void flush_buffers __ARGS((int typeahead));
Karsten Hopp 60da82
  void ResetRedobuff __ARGS((void));
Karsten Hopp 60da82
  void saveRedobuff __ARGS((void));
Karsten Hopp 60da82
  void restoreRedobuff __ARGS((void));
Karsten Hopp 60da82
  void AppendToRedobuff __ARGS((char_u *s));
Karsten Hopp 60da82
--- 4,12 ----
Karsten Hopp 60da82
  char_u *get_inserted __ARGS((void));
Karsten Hopp 60da82
  int stuff_empty __ARGS((void));
Karsten Hopp 60da82
  void typeahead_noflush __ARGS((int c));
Karsten Hopp 60da82
! void flush_buffers __ARGS((int flush_typeahead));
Karsten Hopp 60da82
  void ResetRedobuff __ARGS((void));
Karsten Hopp 60da82
+ void CancelRedo __ARGS((void));
Karsten Hopp 60da82
  void saveRedobuff __ARGS((void));
Karsten Hopp 60da82
  void restoreRedobuff __ARGS((void));
Karsten Hopp 60da82
  void AppendToRedobuff __ARGS((char_u *s));
Karsten Hopp 60da82
*** ../vim-7.3.428/src/version.c	2012-02-05 00:47:56.000000000 +0100
Karsten Hopp 60da82
--- src/version.c	2012-02-05 01:09:23.000000000 +0100
Karsten Hopp 60da82
***************
Karsten Hopp 60da82
*** 716,717 ****
Karsten Hopp 60da82
--- 716,719 ----
Karsten Hopp 60da82
  {   /* Add new patch number below this line */
Karsten Hopp 60da82
+ /**/
Karsten Hopp 60da82
+     429,
Karsten Hopp 60da82
  /**/
Karsten Hopp 60da82
Karsten Hopp 60da82
-- 
Karsten Hopp 60da82
The History of every major Galactic Civilization tends to pass through
Karsten Hopp 60da82
three distinct and recognizable phases, those of Survival, Inquiry and
Karsten Hopp 60da82
Sophistication, otherwise known as the How, Why and Where phases.
Karsten Hopp 60da82
For instance, the first phase is characterized by the question 'How can
Karsten Hopp 60da82
we eat?' the second by the question 'Why do we eat?' and the third by
Karsten Hopp 60da82
the question 'Where shall we have lunch?'
Karsten Hopp 60da82
		-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
Karsten Hopp 60da82
Karsten Hopp 60da82
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 60da82
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 60da82
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 60da82
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///