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