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