073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.479
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.479
073263
Problem:    MS-Windows: The console title can be wrong.
073263
Solution:   Take the encoding into account. When restoring the title use the
073263
	    right function. (Yasuhiro Matsumoto)
073263
Files:	    src/os_mswin.c, src/os_win32.c
073263
073263
073263
*** ../vim-7.4.478/src/os_mswin.c	2014-10-09 17:05:51.944916242 +0200
073263
--- src/os_mswin.c	2014-10-15 22:46:06.922093200 +0200
073263
***************
073263
*** 344,350 ****
073263
      int which)
073263
  {
073263
  #ifndef FEAT_GUI_MSWIN
073263
!     mch_settitle((which & 1) ? g_szOrigTitle : NULL, NULL);
073263
  #endif
073263
  }
073263
  
073263
--- 344,350 ----
073263
      int which)
073263
  {
073263
  #ifndef FEAT_GUI_MSWIN
073263
!     SetConsoleTitle(g_szOrigTitle);
073263
  #endif
073263
  }
073263
  
073263
*** ../vim-7.4.478/src/os_win32.c	2014-10-07 10:38:34.737403070 +0200
073263
--- src/os_win32.c	2014-10-15 22:49:22.358093627 +0200
073263
***************
073263
*** 4648,4653 ****
073263
--- 4648,4682 ----
073263
  #ifdef FEAT_TITLE
073263
      char szShellTitle[512];
073263
  
073263
+ # ifdef FEAT_MBYTE
073263
+     /* Change the title to reflect that we are in a subshell. */
073263
+     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
073263
+     {
073263
+ 	WCHAR szShellTitle[512];
073263
+ 
073263
+ 	if (GetConsoleTitleW(szShellTitle,
073263
+ 				  sizeof(szShellTitle)/sizeof(WCHAR) - 4) > 0)
073263
+ 	{
073263
+ 	    if (cmd == NULL)
073263
+ 		wcscat(szShellTitle, L" :sh");
073263
+ 	    else
073263
+ 	    {
073263
+ 		WCHAR *wn = enc_to_utf16(cmd, NULL);
073263
+ 
073263
+ 		if (wn != NULL)
073263
+ 		{
073263
+ 		    wcscat(szShellTitle, L" - !");
073263
+ 		    if ((wcslen(szShellTitle) + wcslen(wn) <
073263
+ 					  sizeof(szShellTitle)/sizeof(WCHAR)))
073263
+ 			wcscat(szShellTitle, wn);
073263
+ 		    SetConsoleTitleW(szShellTitle);
073263
+ 		    vim_free(wn);
073263
+ 		    goto didset;
073263
+ 		}
073263
+ 	    }
073263
+ 	}
073263
+     }
073263
+ #endif
073263
      /* Change the title to reflect that we are in a subshell. */
073263
      if (GetConsoleTitle(szShellTitle, sizeof(szShellTitle) - 4) > 0)
073263
      {
073263
***************
073263
*** 4659,4665 ****
073263
  	    if ((strlen(szShellTitle) + strlen(cmd) < sizeof(szShellTitle)))
073263
  		strcat(szShellTitle, cmd);
073263
  	}
073263
! 	mch_settitle(szShellTitle, NULL);
073263
      }
073263
  #endif
073263
  
073263
--- 4688,4694 ----
073263
  	    if ((strlen(szShellTitle) + strlen(cmd) < sizeof(szShellTitle)))
073263
  		strcat(szShellTitle, cmd);
073263
  	}
073263
! 	SetConsoleTitle(szShellTitle);
073263
      }
073263
  #endif
073263
  
073263
*** ../vim-7.4.478/src/version.c	2014-10-15 21:26:35.566082778 +0200
073263
--- src/version.c	2014-10-15 22:45:44.810093152 +0200
073263
***************
073263
*** 743,744 ****
073263
--- 743,746 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     479,
073263
  /**/
073263
073263
-- 
073263
MAN:    Fetchez la vache!
073263
GUARD:  Quoi?
073263
MAN:    Fetchez la vache!
073263
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
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    ///