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