Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.3.111
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.111 (after 7.3.100)
Problem:    Executing a :normal command in 'statusline' evaluation causes the
	    cursor to move. (Dominique Pelle)
Solution:   When updating the cursor for 'cursorbind' allow the cursor beyond
	    the end of the line.  When evaluating 'statusline' temporarily
	    reset 'cursorbind'.
Files:	    src/move.c, src/screen.c


*** ../vim-7.3.110/src/move.c	2011-01-22 21:05:02.000000000 +0100
--- src/move.c	2011-02-01 17:36:10.000000000 +0100
***************
*** 2846,2851 ****
--- 2846,2852 ----
      colnr_T	col =  curwin->w_cursor.col;
      win_T	*old_curwin = curwin;
      buf_T	*old_curbuf = curbuf;
+     int		restart_edit_save;
  # ifdef FEAT_VISUAL
      int		old_VIsual_select = VIsual_select;
      int		old_VIsual_active = VIsual_active;
***************
*** 2875,2882 ****
  		curwin->w_cursor.lnum = line;
  	    curwin->w_cursor.col = col;
  
! 	    /* Make sure the cursor is in a valid position. */
  	    check_cursor();
  # ifdef FEAT_MBYTE
  	    /* Correct cursor for multi-byte character. */
  	    if (has_mbyte)
--- 2876,2887 ----
  		curwin->w_cursor.lnum = line;
  	    curwin->w_cursor.col = col;
  
! 	    /* Make sure the cursor is in a valid position.  Temporarily set
! 	     * "restart_edit" to allow the cursor to be beyond the EOL. */
! 	    restart_edit_save = restart_edit;
! 	    restart_edit = TRUE;
  	    check_cursor();
+ 	    restart_edit = restart_edit_save;
  # ifdef FEAT_MBYTE
  	    /* Correct cursor for multi-byte character. */
  	    if (has_mbyte)
*** ../vim-7.3.110/src/screen.c	2010-12-30 14:57:03.000000000 +0100
--- src/screen.c	2011-02-01 17:45:45.000000000 +0100
***************
*** 6435,6440 ****
--- 6435,6442 ----
      struct	stl_hlrec hltab[STL_MAX_ITEM];
      struct	stl_hlrec tabtab[STL_MAX_ITEM];
      int		use_sandbox = FALSE;
+     win_T	*ewp;
+     int		p_crb_save;
  
      /* setup environment for the task at hand */
      if (wp == NULL)
***************
*** 6513,6526 ****
      if (maxwidth <= 0)
  	return;
  
      /* Make a copy, because the statusline may include a function call that
       * might change the option value and free the memory. */
      stl = vim_strsave(stl);
!     width = build_stl_str_hl(wp == NULL ? curwin : wp,
! 				buf, sizeof(buf),
  				stl, use_sandbox,
  				fillchar, maxwidth, hltab, tabtab);
      vim_free(stl);
  
      /* Make all characters printable. */
      p = transstr(buf);
--- 6515,6534 ----
      if (maxwidth <= 0)
  	return;
  
+     /* Temporarily reset 'cursorbind', we don't want a side effect from moving
+      * the cursor away and back. */
+     ewp = wp == NULL ? curwin : wp;
+     p_crb_save = ewp->w_p_crb;
+     ewp->w_p_crb = FALSE;
+ 
      /* Make a copy, because the statusline may include a function call that
       * might change the option value and free the memory. */
      stl = vim_strsave(stl);
!     width = build_stl_str_hl(ewp, buf, sizeof(buf),
  				stl, use_sandbox,
  				fillchar, maxwidth, hltab, tabtab);
      vim_free(stl);
+     ewp->w_p_crb = p_crb_save;
  
      /* Make all characters printable. */
      p = transstr(buf);
*** ../vim-7.3.110/src/version.c	2011-02-01 17:12:20.000000000 +0100
--- src/version.c	2011-02-01 18:00:14.000000000 +0100
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     111,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
177. You log off of your system because it's time to go to work.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///