Blame SOURCES/7.4.067

22c937
To: vim_dev@googlegroups.com
22c937
Subject: Patch 7.4.067
22c937
Fcc: outbox
22c937
From: Bram Moolenaar <Bram@moolenaar.net>
22c937
Mime-Version: 1.0
22c937
Content-Type: text/plain; charset=UTF-8
22c937
Content-Transfer-Encoding: 8bit
22c937
------------
22c937
22c937
Patch 7.4.067
22c937
Problem:    After inserting comment leader, CTRL-\ CTRL-O does move the
22c937
            cursor. (Wiktor Ruben)
22c937
Solution:   Avoid moving the cursor. (Christian Brabandt)
22c937
Files:      src/edit.c
22c937
22c937
22c937
*** ../vim-7.4.066/src/edit.c	2013-09-08 20:00:45.000000000 +0200
22c937
--- src/edit.c	2013-11-04 03:57:43.000000000 +0100
22c937
***************
22c937
*** 199,205 ****
22c937
  static void spell_back_to_badword __ARGS((void));
22c937
  static int  spell_bad_len = 0;	/* length of located bad word */
22c937
  #endif
22c937
! static void stop_insert __ARGS((pos_T *end_insert_pos, int esc));
22c937
  static int  echeck_abbr __ARGS((int));
22c937
  static int  replace_pop __ARGS((void));
22c937
  static void replace_join __ARGS((int off));
22c937
--- 199,205 ----
22c937
  static void spell_back_to_badword __ARGS((void));
22c937
  static int  spell_bad_len = 0;	/* length of located bad word */
22c937
  #endif
22c937
! static void stop_insert __ARGS((pos_T *end_insert_pos, int esc, int nomove));
22c937
  static int  echeck_abbr __ARGS((int));
22c937
  static int  replace_pop __ARGS((void));
22c937
  static void replace_join __ARGS((int off));
22c937
***************
22c937
*** 6698,6704 ****
22c937
      if (!arrow_used)	    /* something has been inserted */
22c937
      {
22c937
  	AppendToRedobuff(ESC_STR);
22c937
! 	stop_insert(end_insert_pos, FALSE);
22c937
  	arrow_used = TRUE;	/* this means we stopped the current insert */
22c937
      }
22c937
  #ifdef FEAT_SPELL
22c937
--- 6698,6704 ----
22c937
      if (!arrow_used)	    /* something has been inserted */
22c937
      {
22c937
  	AppendToRedobuff(ESC_STR);
22c937
! 	stop_insert(end_insert_pos, FALSE, FALSE);
22c937
  	arrow_used = TRUE;	/* this means we stopped the current insert */
22c937
      }
22c937
  #ifdef FEAT_SPELL
22c937
***************
22c937
*** 6787,6795 ****
22c937
   * to another window/buffer.
22c937
   */
22c937
      static void
22c937
! stop_insert(end_insert_pos, esc)
22c937
      pos_T	*end_insert_pos;
22c937
      int		esc;			/* called by ins_esc() */
22c937
  {
22c937
      int		cc;
22c937
      char_u	*ptr;
22c937
--- 6787,6796 ----
22c937
   * to another window/buffer.
22c937
   */
22c937
      static void
22c937
! stop_insert(end_insert_pos, esc, nomove)
22c937
      pos_T	*end_insert_pos;
22c937
      int		esc;			/* called by ins_esc() */
22c937
+     int		nomove;			/* <c-\><c-o>, don't move cursor */
22c937
  {
22c937
      int		cc;
22c937
      char_u	*ptr;
22c937
***************
22c937
*** 6860,6866 ****
22c937
  	 * Do this when ESC was used or moving the cursor up/down.
22c937
  	 * Check for the old position still being valid, just in case the text
22c937
  	 * got changed unexpectedly. */
22c937
! 	if (did_ai && (esc || (vim_strchr(p_cpo, CPO_INDENT) == NULL
22c937
  			&& curwin->w_cursor.lnum != end_insert_pos->lnum))
22c937
  		&& end_insert_pos->lnum <= curbuf->b_ml.ml_line_count)
22c937
  	{
22c937
--- 6861,6867 ----
22c937
  	 * Do this when ESC was used or moving the cursor up/down.
22c937
  	 * Check for the old position still being valid, just in case the text
22c937
  	 * got changed unexpectedly. */
22c937
! 	if (!nomove && did_ai && (esc || (vim_strchr(p_cpo, CPO_INDENT) == NULL
22c937
  			&& curwin->w_cursor.lnum != end_insert_pos->lnum))
22c937
  		&& end_insert_pos->lnum <= curbuf->b_ml.ml_line_count)
22c937
  	{
22c937
***************
22c937
*** 8377,8383 ****
22c937
  	    disabled_redraw = TRUE;
22c937
  	    return FALSE;	/* repeat the insert */
22c937
  	}
22c937
! 	stop_insert(&curwin->w_cursor, TRUE);
22c937
  	undisplay_dollar();
22c937
      }
22c937
  
22c937
--- 8378,8384 ----
22c937
  	    disabled_redraw = TRUE;
22c937
  	    return FALSE;	/* repeat the insert */
22c937
  	}
22c937
! 	stop_insert(&curwin->w_cursor, TRUE, nomove);
22c937
  	undisplay_dollar();
22c937
      }
22c937
  
22c937
*** ../vim-7.4.066/src/version.c	2013-11-04 02:53:46.000000000 +0100
22c937
--- src/version.c	2013-11-04 03:57:29.000000000 +0100
22c937
***************
22c937
*** 740,741 ****
22c937
--- 740,743 ----
22c937
  {   /* Add new patch number below this line */
22c937
+ /**/
22c937
+     67,
22c937
  /**/
22c937
22c937
-- 
22c937
Beer & pretzels can't be served at the same time in any bar or restaurant.
22c937
		[real standing law in North Dakota, United States of America]
22c937
22c937
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
22c937
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
22c937
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
22c937
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///