Bug#558153: vim-gnome: Terminating Vim will not restore the window title if the old title containing non-ASCII characters.

Morita Sho morita-pub-en-debian at inz.sakura.ne.jp
Thu Nov 26 18:38:04 UTC 2009


Package: vim-gnome
Version: 2:7.2.284-1
Severity: normal
Tags: patch

Hi,

I'm using vim-gnome in a GNOME Terminal.
The default window title for GNOME Terminal is set to "GNOME 端末" in Japanese locale.

When I open a file with vim, the window title will be replaced with "<filename> (<directory>) - VIM".
Then I quitting vim, at that time I expected the window title is restored to
"GNOME 端末", but it is still "<filename> (<directory>) - VIM".

The window title will be successfully restored if the window title is not
containing non-ASCII characters, therefore I'm suspecting the problem is
multibyte/non-ASCII character specific.


After some investigations, I'm suspecting that the following #ifdef conditions are incorrect.
vim-7.2.284/src/os_unix.c:
#ifdef FEAT_XFONTSET
		if (text_prop.encoding == XA_STRING)
		{
#endif
		    if (get_title)
			oldtitle = vim_strsave((char_u *)text_prop.value);
		    else
			oldicon = vim_strsave((char_u *)text_prop.value);
#ifdef FEAT_XFONTSET
		}
		else
		{
		    char    **cl;
		    Status  transform_status;
		    int	    n = 0;

		    transform_status = XmbTextPropertyToTextList(x11_display,
								 &text_prop,
								 &cl, &n);
		    if (transform_status >= Success && n > 0 && cl[0])
		    {
			if (get_title)
			    oldtitle = vim_strsave((char_u *) cl[0]);
			else
			    oldicon = vim_strsave((char_u *) cl[0]);
			XFreeStringList(cl);
		    }
		    else
		    {
			if (get_title)
			    oldtitle = vim_strsave((char_u *)text_prop.value);
			else
			    oldicon = vim_strsave((char_u *)text_prop.value);
		    }
		}
#endif

These code blocks seems to be required to handle a multibyte character. However
FEAT_XFONTSET macro is not defined while compiling vim-gnome, therefore it
couldn't handle a multibyte character. I suggest to change the #ifdef conditions
as following.

#if defined(FEAT_XFONTSET) || ( defined(HAVE_X11) && defined(FEAT_MBYTE) )


I made and attached a patch to fix the problem.

Thanks,

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.31-1-686 (SMP w/1 CPU core)
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages vim-gnome depends on:
ii  libacl1                   2.2.49-1       Access control list shared library
ii  libbonoboui2-0            2.24.2-1       The Bonobo UI library
ii  libc6                     2.10.2-2       GNU C Library: Shared libraries
ii  libglib2.0-0              2.22.2-2       The GLib library of C routines
ii  libgnome2-0               2.28.0-1       The GNOME library - runtime files
ii  libgnomeui-0              2.24.2-1       The GNOME libraries (User Interfac
ii  libgpm2                   1.20.4-3.2     General Purpose Mouse - shared lib
ii  libgtk2.0-0               2.18.3-1       The GTK+ graphical user interface 
ii  libice6                   2:1.0.6-1      X11 Inter-Client Exchange library
ii  libncurses5               5.7+20090803-2 shared libraries for terminal hand
ii  libpango1.0-0             1.26.1-1       Layout and rendering of internatio
ii  libperl5.10               5.10.1-8       shared Perl library
ii  libruby1.8                1.8.7.174-2    Libraries necessary to run Ruby 1.
ii  libselinux1               2.0.89-4       SELinux runtime shared libraries
ii  libsm6                    2:1.1.1-1      X11 Session Management library
ii  libx11-6                  2:1.3.2-1      X11 client-side library
ii  libxt6                    1:1.0.7-1      X11 toolkit intrinsics library
ii  python2.5                 2.5.4-3        An interactive high-level object-o
ii  tcl8.4                    8.4.19-4       Tcl (the Tool Command Language) v8
ii  vim-common                2:7.2.284-1    Vi IMproved - Common files
ii  vim-gui-common            2:7.2.284-1    Vi IMproved - Common GUI files
ii  vim-runtime               2:7.2.284-1    Vi IMproved - Runtime files

vim-gnome recommends no packages.

Versions of packages vim-gnome suggests:
pn  cscope                        <none>     (no description available)
ii  gnome-icon-theme              2.28.0-1   GNOME Desktop icon theme
ii  ttf-dejavu                    2.30-1     Metapackage to pull in ttf-dejavu-
pn  vim-doc                       <none>     (no description available)

-- no debconf information
-------------- next part --------------
--- vim-7.2.284/src/os_unix.c.orig	2009-11-06 10:34:41.000000000 +0900
+++ vim-7.2.284/src/os_unix.c	2009-11-27 02:48:52.000000000 +0900
@@ -1797,7 +1797,7 @@
 	    retval = TRUE;
 	    if (!test_only)
 	    {
-#ifdef FEAT_XFONTSET
+#if defined(FEAT_XFONTSET) || ( defined(HAVE_X11) && defined(FEAT_MBYTE) )
 		if (text_prop.encoding == XA_STRING)
 		{
 #endif
@@ -1805,7 +1805,7 @@
 			oldtitle = vim_strsave((char_u *)text_prop.value);
 		    else
 			oldicon = vim_strsave((char_u *)text_prop.value);
-#ifdef FEAT_XFONTSET
+#if defined(FEAT_XFONTSET) || ( defined(HAVE_X11) && defined(FEAT_MBYTE) )
 		}
 		else
 		{


More information about the pkg-vim-maintainers mailing list