Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.2.152
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.2.152
Problem:    When using "silent echo x" inside ":redir" a next echo may start
	    halfway the line. (Tony Mechelynck, Dennis Benzinger)
Solution:   Reset msg_col after redirecting silently.
Files:	    src/ex_docmd.c, src/message.c, src/proto/message.pro


*** ../vim-7.2.151/src/ex_docmd.c	Wed Mar 18 12:50:58 2009
--- src/ex_docmd.c	Wed Apr 22 11:57:49 2009
***************
*** 2699,2704 ****
--- 2699,2709 ----
  	/* Restore msg_scroll, it's set by file I/O commands, even when no
  	 * message is actually displayed. */
  	msg_scroll = save_msg_scroll;
+ 
+ 	/* "silent reg" or "silent echo x" inside "redir" leaves msg_col
+ 	 * somewhere in the line.  Put it back in the first column. */
+ 	if (redirecting())
+ 	    msg_col = 0;
      }
  
  #ifdef HAVE_SANDBOX
*** ../vim-7.2.151/src/message.c	Tue Feb 24 04:36:50 2009
--- src/message.c	Sun Apr 12 14:08:25 2009
***************
*** 3023,3033 ****
      if (*p_vfile != NUL)
  	verbose_write(s, maxlen);
  
!     if (redir_fd != NULL
! #ifdef FEAT_EVAL
! 			  || redir_reg || redir_vname
! #endif
! 				       )
      {
  	/* If the string doesn't start with CR or NL, go to msg_col */
  	if (*s != '\n' && *s != '\r')
--- 3023,3029 ----
      if (*p_vfile != NUL)
  	verbose_write(s, maxlen);
  
!     if (redirecting())
      {
  	/* If the string doesn't start with CR or NL, go to msg_col */
  	if (*s != '\n' && *s != '\r')
***************
*** 3074,3079 ****
--- 3070,3085 ----
      }
  }
  
+     int
+ redirecting()
+ {
+     return redir_fd != NULL
+ #ifdef FEAT_EVAL
+ 			  || redir_reg || redir_vname
+ #endif
+ 				       ;
+ }
+ 
  /*
   * Before giving verbose message.
   * Must always be called paired with verbose_leave()!
*** ../vim-7.2.151/src/proto/message.pro	Sat May  5 19:35:34 2007
--- src/proto/message.pro	Sun Apr 12 14:08:50 2009
***************
*** 54,59 ****
--- 54,60 ----
  void msg_clr_cmdline __ARGS((void));
  int msg_end __ARGS((void));
  void msg_check __ARGS((void));
+ int redirecting __ARGS((void));
  void verbose_enter __ARGS((void));
  void verbose_leave __ARGS((void));
  void verbose_enter_scroll __ARGS((void));
*** ../vim-7.2.151/src/version.c	Wed Apr 22 13:50:14 2009
--- src/version.c	Wed Apr 22 14:40:22 2009
***************
*** 678,679 ****
--- 678,681 ----
  {   /* Add new patch number below this line */
+ /**/
+     152,
  /**/

-- 
Q: How does a UNIX Guru pick up a girl?
A: look; grep; which; eval; nice; uname; talk; date;

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///