jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.122

dcaee6
To: vim_dev@googlegroups.com
dcaee6
Subject: Patch 7.4.122
dcaee6
Fcc: outbox
dcaee6
From: Bram Moolenaar <Bram@moolenaar.net>
dcaee6
Mime-Version: 1.0
dcaee6
Content-Type: text/plain; charset=UTF-8
dcaee6
Content-Transfer-Encoding: 8bit
dcaee6
------------
dcaee6
dcaee6
Patch 7.4.122
dcaee6
Problem:    Win32: When 'encoding' is set to "utf-8" and the active codepage
dcaee6
	    is cp932 then ":grep" and other commands don't work for multi-byte
dcaee6
	    characters.
dcaee6
Solution:   (Yasuhiro Matsumoto)
dcaee6
Files:	    src/os_win32.c
dcaee6
dcaee6
dcaee6
*** ../vim-7.4.121/src/os_win32.c	2013-12-07 14:48:06.000000000 +0100
dcaee6
--- src/os_win32.c	2013-12-11 17:57:48.000000000 +0100
dcaee6
***************
dcaee6
*** 3788,3793 ****
dcaee6
--- 3788,3837 ----
dcaee6
  }
dcaee6
  #endif /* FEAT_GUI_W32 */
dcaee6
  
dcaee6
+     static BOOL
dcaee6
+ vim_create_process(
dcaee6
+     const char		*cmd,
dcaee6
+     DWORD		flags,
dcaee6
+     BOOL		inherit_handles,
dcaee6
+     STARTUPINFO		*si,
dcaee6
+     PROCESS_INFORMATION *pi)
dcaee6
+ {
dcaee6
+ #  ifdef FEAT_MBYTE
dcaee6
+     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
dcaee6
+     {
dcaee6
+ 	WCHAR	*wcmd = enc_to_utf16(cmd, NULL);
dcaee6
+ 
dcaee6
+ 	if (wcmd != NULL)
dcaee6
+ 	{
dcaee6
+ 	    BOOL ret;
dcaee6
+ 	    ret = CreateProcessW(
dcaee6
+ 		NULL,			/* Executable name */
dcaee6
+ 		wcmd,			/* Command to execute */
dcaee6
+ 		NULL,			/* Process security attributes */
dcaee6
+ 		NULL,			/* Thread security attributes */
dcaee6
+ 		inherit_handles,	/* Inherit handles */
dcaee6
+ 		flags,			/* Creation flags */
dcaee6
+ 		NULL,			/* Environment */
dcaee6
+ 		NULL,			/* Current directory */
dcaee6
+ 		si,			/* Startup information */
dcaee6
+ 		pi);			/* Process information */
dcaee6
+ 	    vim_free(wcmd);
dcaee6
+ 	    return ret;
dcaee6
+ 	}
dcaee6
+     }
dcaee6
+ #endif
dcaee6
+     return CreateProcess(
dcaee6
+ 	NULL,			/* Executable name */
dcaee6
+ 	cmd,			/* Command to execute */
dcaee6
+ 	NULL,			/* Process security attributes */
dcaee6
+ 	NULL,			/* Thread security attributes */
dcaee6
+ 	inherit_handles,	/* Inherit handles */
dcaee6
+ 	flags,			/* Creation flags */
dcaee6
+ 	NULL,			/* Environment */
dcaee6
+ 	NULL,			/* Current directory */
dcaee6
+ 	si,			/* Startup information */
dcaee6
+ 	pi);			/* Process information */
dcaee6
+ }
dcaee6
  
dcaee6
  
dcaee6
  #if defined(FEAT_GUI_W32) || defined(PROTO)
dcaee6
***************
dcaee6
*** 3834,3851 ****
dcaee6
  	cmd += 3;
dcaee6
  
dcaee6
      /* Now, run the command */
dcaee6
!     CreateProcess(NULL,			/* Executable name */
dcaee6
! 		  cmd,			/* Command to execute */
dcaee6
! 		  NULL,			/* Process security attributes */
dcaee6
! 		  NULL,			/* Thread security attributes */
dcaee6
! 		  FALSE,		/* Inherit handles */
dcaee6
! 		  CREATE_DEFAULT_ERROR_MODE |	/* Creation flags */
dcaee6
! 			CREATE_NEW_CONSOLE,
dcaee6
! 		  NULL,			/* Environment */
dcaee6
! 		  NULL,			/* Current directory */
dcaee6
! 		  &si,			/* Startup information */
dcaee6
! 		  &pi);			/* Process information */
dcaee6
! 
dcaee6
  
dcaee6
      /* Wait for the command to terminate before continuing */
dcaee6
      if (g_PlatformId != VER_PLATFORM_WIN32s)
dcaee6
--- 3878,3885 ----
dcaee6
  	cmd += 3;
dcaee6
  
dcaee6
      /* Now, run the command */
dcaee6
!     vim_create_process(cmd, FALSE,
dcaee6
! 	    CREATE_DEFAULT_ERROR_MODE |	CREATE_NEW_CONSOLE, &si, &pi);
dcaee6
  
dcaee6
      /* Wait for the command to terminate before continuing */
dcaee6
      if (g_PlatformId != VER_PLATFORM_WIN32s)
dcaee6
***************
dcaee6
*** 4177,4198 ****
dcaee6
  	    p = cmd;
dcaee6
      }
dcaee6
  
dcaee6
!     /* Now, run the command */
dcaee6
!     CreateProcess(NULL,			/* Executable name */
dcaee6
! 		  p,			/* Command to execute */
dcaee6
! 		  NULL,			/* Process security attributes */
dcaee6
! 		  NULL,			/* Thread security attributes */
dcaee6
! 
dcaee6
! 		  // this command can be litigious, handle inheritance was
dcaee6
! 		  // deactivated for pending temp file, but, if we deactivate
dcaee6
! 		  // it, the pipes don't work for some reason.
dcaee6
! 		  TRUE,			/* Inherit handles, first deactivated,
dcaee6
! 					 * but needed */
dcaee6
! 		  CREATE_DEFAULT_ERROR_MODE, /* Creation flags */
dcaee6
! 		  NULL,			/* Environment */
dcaee6
! 		  NULL,			/* Current directory */
dcaee6
! 		  &si,			/* Startup information */
dcaee6
! 		  &pi);			/* Process information */
dcaee6
  
dcaee6
      if (p != cmd)
dcaee6
  	vim_free(p);
dcaee6
--- 4211,4221 ----
dcaee6
  	    p = cmd;
dcaee6
      }
dcaee6
  
dcaee6
!     /* Now, run the command.
dcaee6
!      * About "Inherit handles" being TRUE: this command can be litigious,
dcaee6
!      * handle inheritance was deactivated for pending temp file, but, if we
dcaee6
!      * deactivate it, the pipes don't work for some reason. */
dcaee6
!      vim_create_process(p, TRUE, CREATE_DEFAULT_ERROR_MODE, &si, &pi);
dcaee6
  
dcaee6
      if (p != cmd)
dcaee6
  	vim_free(p);
dcaee6
***************
dcaee6
*** 4410,4416 ****
dcaee6
  }
dcaee6
  #else
dcaee6
  
dcaee6
! # define mch_system(c, o) system(c)
dcaee6
  
dcaee6
  #endif
dcaee6
  
dcaee6
--- 4433,4457 ----
dcaee6
  }
dcaee6
  #else
dcaee6
  
dcaee6
! # ifdef FEAT_MBYTE
dcaee6
!     static int
dcaee6
! mch_system(char *cmd, int options)
dcaee6
! {
dcaee6
!     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
dcaee6
!     {
dcaee6
! 	WCHAR	*wcmd = enc_to_utf16(cmd, NULL);
dcaee6
! 	if (wcmd != NULL)
dcaee6
! 	{
dcaee6
! 	    int ret = _wsystem(wcmd);
dcaee6
! 	    vim_free(wcmd);
dcaee6
! 	    return ret;
dcaee6
! 	}
dcaee6
!     }
dcaee6
!     return system(cmd);
dcaee6
! }
dcaee6
! # else
dcaee6
! #  define mch_system(c, o) system(c)
dcaee6
! # endif
dcaee6
  
dcaee6
  #endif
dcaee6
  
dcaee6
***************
dcaee6
*** 4578,4593 ****
dcaee6
  	     * inherit our handles which causes unpleasant dangling swap
dcaee6
  	     * files if we exit before the spawned process
dcaee6
  	     */
dcaee6
! 	    if (CreateProcess(NULL,		// Executable name
dcaee6
! 		    newcmd,			// Command to execute
dcaee6
! 		    NULL,			// Process security attributes
dcaee6
! 		    NULL,			// Thread security attributes
dcaee6
! 		    FALSE,			// Inherit handles
dcaee6
! 		    flags,			// Creation flags
dcaee6
! 		    NULL,			// Environment
dcaee6
! 		    NULL,			// Current directory
dcaee6
! 		    &si,			// Startup information
dcaee6
! 		    &pi))			// Process information
dcaee6
  		x = 0;
dcaee6
  	    else
dcaee6
  	    {
dcaee6
--- 4619,4625 ----
dcaee6
  	     * inherit our handles which causes unpleasant dangling swap
dcaee6
  	     * files if we exit before the spawned process
dcaee6
  	     */
dcaee6
! 	    if (vim_create_process(newcmd, FALSE, flags, &si, &pi))
dcaee6
  		x = 0;
dcaee6
  	    else
dcaee6
  	    {
dcaee6
*** ../vim-7.4.121/src/version.c	2013-12-11 17:44:33.000000000 +0100
dcaee6
--- src/version.c	2013-12-11 17:48:09.000000000 +0100
dcaee6
***************
dcaee6
*** 740,741 ****
dcaee6
--- 740,743 ----
dcaee6
  {   /* Add new patch number below this line */
dcaee6
+ /**/
dcaee6
+     122,
dcaee6
  /**/
dcaee6
dcaee6
-- 
dcaee6
Never overestimate a man's ability to underestimate a woman.
dcaee6
dcaee6
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
dcaee6
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
dcaee6
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
dcaee6
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///