3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.479
3ef2ca
Fcc: outbox
3ef2ca
From: Bram Moolenaar <Bram@moolenaar.net>
3ef2ca
Mime-Version: 1.0
3ef2ca
Content-Type: text/plain; charset=UTF-8
3ef2ca
Content-Transfer-Encoding: 8bit
3ef2ca
------------
3ef2ca
3ef2ca
Patch 7.4.479
3ef2ca
Problem:    MS-Windows: The console title can be wrong.
3ef2ca
Solution:   Take the encoding into account. When restoring the title use the
3ef2ca
	    right function. (Yasuhiro Matsumoto)
3ef2ca
Files:	    src/os_mswin.c, src/os_win32.c
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.478/src/os_mswin.c	2014-10-09 17:05:51.944916242 +0200
3ef2ca
--- src/os_mswin.c	2014-10-15 22:46:06.922093200 +0200
3ef2ca
***************
3ef2ca
*** 344,350 ****
3ef2ca
      int which)
3ef2ca
  {
3ef2ca
  #ifndef FEAT_GUI_MSWIN
3ef2ca
!     mch_settitle((which & 1) ? g_szOrigTitle : NULL, NULL);
3ef2ca
  #endif
3ef2ca
  }
3ef2ca
  
3ef2ca
--- 344,350 ----
3ef2ca
      int which)
3ef2ca
  {
3ef2ca
  #ifndef FEAT_GUI_MSWIN
3ef2ca
!     SetConsoleTitle(g_szOrigTitle);
3ef2ca
  #endif
3ef2ca
  }
3ef2ca
  
3ef2ca
*** ../vim-7.4.478/src/os_win32.c	2014-10-07 10:38:34.737403070 +0200
3ef2ca
--- src/os_win32.c	2014-10-15 22:49:22.358093627 +0200
3ef2ca
***************
3ef2ca
*** 4648,4653 ****
3ef2ca
--- 4648,4682 ----
3ef2ca
  #ifdef FEAT_TITLE
3ef2ca
      char szShellTitle[512];
3ef2ca
  
3ef2ca
+ # ifdef FEAT_MBYTE
3ef2ca
+     /* Change the title to reflect that we are in a subshell. */
3ef2ca
+     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
3ef2ca
+     {
3ef2ca
+ 	WCHAR szShellTitle[512];
3ef2ca
+ 
3ef2ca
+ 	if (GetConsoleTitleW(szShellTitle,
3ef2ca
+ 				  sizeof(szShellTitle)/sizeof(WCHAR) - 4) > 0)
3ef2ca
+ 	{
3ef2ca
+ 	    if (cmd == NULL)
3ef2ca
+ 		wcscat(szShellTitle, L" :sh");
3ef2ca
+ 	    else
3ef2ca
+ 	    {
3ef2ca
+ 		WCHAR *wn = enc_to_utf16(cmd, NULL);
3ef2ca
+ 
3ef2ca
+ 		if (wn != NULL)
3ef2ca
+ 		{
3ef2ca
+ 		    wcscat(szShellTitle, L" - !");
3ef2ca
+ 		    if ((wcslen(szShellTitle) + wcslen(wn) <
3ef2ca
+ 					  sizeof(szShellTitle)/sizeof(WCHAR)))
3ef2ca
+ 			wcscat(szShellTitle, wn);
3ef2ca
+ 		    SetConsoleTitleW(szShellTitle);
3ef2ca
+ 		    vim_free(wn);
3ef2ca
+ 		    goto didset;
3ef2ca
+ 		}
3ef2ca
+ 	    }
3ef2ca
+ 	}
3ef2ca
+     }
3ef2ca
+ #endif
3ef2ca
      /* Change the title to reflect that we are in a subshell. */
3ef2ca
      if (GetConsoleTitle(szShellTitle, sizeof(szShellTitle) - 4) > 0)
3ef2ca
      {
3ef2ca
***************
3ef2ca
*** 4659,4665 ****
3ef2ca
  	    if ((strlen(szShellTitle) + strlen(cmd) < sizeof(szShellTitle)))
3ef2ca
  		strcat(szShellTitle, cmd);
3ef2ca
  	}
3ef2ca
! 	mch_settitle(szShellTitle, NULL);
3ef2ca
      }
3ef2ca
  #endif
3ef2ca
  
3ef2ca
--- 4688,4694 ----
3ef2ca
  	    if ((strlen(szShellTitle) + strlen(cmd) < sizeof(szShellTitle)))
3ef2ca
  		strcat(szShellTitle, cmd);
3ef2ca
  	}
3ef2ca
! 	SetConsoleTitle(szShellTitle);
3ef2ca
      }
3ef2ca
  #endif
3ef2ca
  
3ef2ca
*** ../vim-7.4.478/src/version.c	2014-10-15 21:26:35.566082778 +0200
3ef2ca
--- src/version.c	2014-10-15 22:45:44.810093152 +0200
3ef2ca
***************
3ef2ca
*** 743,744 ****
3ef2ca
--- 743,746 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     479,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
MAN:    Fetchez la vache!
3ef2ca
GUARD:  Quoi?
3ef2ca
MAN:    Fetchez la vache!
3ef2ca
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
3ef2ca
3ef2ca
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
3ef2ca
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
3ef2ca
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
3ef2ca
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///