Blame SOURCES/7.4.479

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