073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.427
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.427
073263
Problem:    When an InsertCharPre autocommand executes system() typeahead may
073263
	    be echoed and messes up the display. (Jacob Niehus)
073263
Solution:   Do not set cooked mode when invoked from ":silent".
073263
Files:	    src/eval.c, runtime/doc/eval.txt
073263
073263
073263
*** ../vim-7.4.426/src/eval.c	2014-08-29 09:46:04.262404970 +0200
073263
--- src/eval.c	2014-08-29 15:37:57.034451088 +0200
073263
***************
073263
*** 18594,18599 ****
073263
--- 18594,18600 ----
073263
      int		err = FALSE;
073263
      FILE	*fd;
073263
      list_T	*list = NULL;
073263
+     int		flags = SHELL_SILENT;
073263
  
073263
      rettv->v_type = VAR_STRING;
073263
      rettv->vval.v_string = NULL;
073263
***************
073263
*** 18643,18648 ****
073263
--- 18644,18654 ----
073263
  	}
073263
      }
073263
  
073263
+     /* Omit SHELL_COOKED when invoked with ":silent".  Avoids that the shell
073263
+      * echoes typeahead, that messes up the display. */
073263
+     if (!msg_silent)
073263
+ 	flags += SHELL_COOKED;
073263
+ 
073263
      if (retlist)
073263
      {
073263
  	int		len;
073263
***************
073263
*** 18652,18659 ****
073263
  	char_u		*end;
073263
  	int		i;
073263
  
073263
! 	res = get_cmd_output(get_tv_string(&argvars[0]), infile,
073263
! 					   SHELL_SILENT | SHELL_COOKED, &len;;
073263
  	if (res == NULL)
073263
  	    goto errret;
073263
  
073263
--- 18658,18664 ----
073263
  	char_u		*end;
073263
  	int		i;
073263
  
073263
! 	res = get_cmd_output(get_tv_string(&argvars[0]), infile, flags, &len;;
073263
  	if (res == NULL)
073263
  	    goto errret;
073263
  
073263
***************
073263
*** 18694,18701 ****
073263
      }
073263
      else
073263
      {
073263
! 	res = get_cmd_output(get_tv_string(&argvars[0]), infile,
073263
! 					   SHELL_SILENT | SHELL_COOKED, NULL);
073263
  #ifdef USE_CR
073263
  	/* translate <CR> into <NL> */
073263
  	if (res != NULL)
073263
--- 18699,18705 ----
073263
      }
073263
      else
073263
      {
073263
! 	res = get_cmd_output(get_tv_string(&argvars[0]), infile, flags, NULL);
073263
  #ifdef USE_CR
073263
  	/* translate <CR> into <NL> */
073263
  	if (res != NULL)
073263
*** ../vim-7.4.426/runtime/doc/eval.txt	2014-08-06 14:52:05.035236174 +0200
073263
--- runtime/doc/eval.txt	2014-08-29 15:49:48.918452643 +0200
073263
***************
073263
*** 6071,6076 ****
073263
--- 6093,6104 ----
073263
  		list items converted to NULs).  
073263
  		Pipes are not used.
073263
  
073263
+ 		When prepended by |:silent| the shell will not be set to
073263
+ 		cooked mode.  This is meant to be used for commands that do
073263
+ 		not need the user to type.  It avoids stray characters showing
073263
+ 		up on the screen which require |CTRL-L| to remove. >
073263
+ 			:silent let f = system('ls *.vim')
073263
+ <
073263
  		Note: Use |shellescape()| or |::S| with |expand()| or 
073263
  		|fnamemodify()| to escape special characters in a command 
073263
  		argument.  Newlines in {expr} may cause the command to fail.  
073263
*** ../vim-7.4.426/src/version.c	2014-08-29 15:12:50.950447798 +0200
073263
--- src/version.c	2014-08-29 15:39:07.862451242 +0200
073263
***************
073263
*** 743,744 ****
073263
--- 743,746 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     427,
073263
  /**/
073263
073263
-- 
073263
How many light bulbs does it take to change a person?
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///