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