Beep on exit

2 views
Skip to first unread message

Anatoli Sakhnik

unread,
Jul 22, 2010, 5:34:29 PM7/22/10
to vim_dev
There appeared one annoying thing in vim-7.3 (starting even from
alpha). Every time I quit the editor, it beeps.

1) 'visualbell' is set.
2) 't_vb' is reset. In fact, when I set it to A, I see that character
is printed on excessive <esc>, but Vim still beeps on exit.
3) I'm sure this isn't about plugins and configuration, because
vim-7.2 didn't beep, and I tried to remove .vim and .vimrc

The system is Fedora 13. How can I debug the problem? What other piece
of code can print BELL?

Tony Mechelynck

unread,
Jul 23, 2010, 10:15:53 PM7/23/10
to vim...@googlegroups.com, Anatoli Sakhnik

Well, :echo "\x07" (with the double quotes) will issue a beep on most
terminals; but I wouldn't say that it's a commonplace thing to do.

When you do
:verbose au VimLeave
does it mention anything? Those autocommands would be run as the last
thing before exiting Vim.


Best regards,
Tony.
--
The only really good place to buy lumber is at a store where the lumber
has already been cut and attached together in the form of furniture,
finished, and put inside boxes.
-- Dave Barry, "The Taming of the Screw"

Anatoli Sakhnik

unread,
Jul 24, 2010, 1:56:05 AM7/24/10
to vim_dev
No, nothing is output. I suspect either the code prints BEEP (007) or
one of used libraries. Let me experiment with different systems and
build options.

On 24 Лип, 05:15, Tony Mechelynck <antoine.mechely...@gmail.com>
wrote:

Anatoli Sakhnik

unread,
Jul 24, 2010, 5:36:50 AM7/24/10
to vim_dev
Now I know what happens, and this is a bug either of vim or of gnome-
terminal. I traced the code from :quit, and noticed the following
calls: mch_exit() -> mch_restore_title() -> mch_settitle(). Beeps are
produced by the strings oldtitle and oldicon, which are filled with
garbage. So the real evil happens in function get_x11_thing, which
can't deal with my LOCALIZED gnome-terminal. I use Ukrainian language
in the GUI, so the title is Ukrainian "Термінал".

How shall we fix this?

On 24 Лип, 05:15, Tony Mechelynck <antoine.mechely...@gmail.com>
wrote:
>

Tony Mechelynck

unread,
Jul 24, 2010, 8:41:50 AM7/24/10
to vim...@googlegroups.com, Anatoli Sakhnik
On 24/07/10 11:36, Anatoli Sakhnik wrote:
> Now I know what happens, and this is a bug either of vim or of gnome-
> terminal. I traced the code from :quit, and noticed the following
> calls: mch_exit() -> mch_restore_title() -> mch_settitle(). Beeps are
> produced by the strings oldtitle and oldicon, which are filled with
> garbage. So the real evil happens in function get_x11_thing, which
> can't deal with my LOCALIZED gnome-terminal. I use Ukrainian language
> in the GUI, so the title is Ukrainian "Термінал".

Hm, what are the answers to each of the following in Vim running in
gnome-terminal?

:verbose set enc? tenc? term? t_ts? title? titlestring?
:lang cty
:echo has('title')
:echo has('X11')
:echo has('xterm_save')

Does anything change if (assuming bash shell) you do

unset LC_ALL LC_CTYPE
export LANG=uk_UA.utf-8

either before starting gnome-terminal (but in the same shell or a parent
shell), or before starting Vim? You may want to check that
'fileencodings' (plural) is appropriately set, maybe something like

set fencs=ucs-bom,utf-8,koi8-u

or similar. (If you use more than one 8-bit encodings for the files you
edit, let's say koi8-u and Windows-1251, Vim won't be able to recognize
which is which when reading the file — anything after the first 8-bit
charset in 'fileencodings' would be ignored: see ":help ++opt" about how
to open files in whatever charset is not your default.)

>
> How shall we fix this?

I don't know (unless the above helps you); but maybe Bram (or someone)
might have an idea. As a temporary workaround, maybe either

:set notitle
or
:set title titlestring=Термінал

but the latter may fail if 'encoding' is different from the charset
defined by the $LC_CTYPE set by your OS.


Best regards,
Tony.
--
Niklaus Wirth has lamented that, whereas Europeans pronounce his name
correctly (Ni-klows Virt), Americans invariably mangle it into
(Nick-les Worth). Which is to say that Europeans call him by name, but
Americans call him by value.

Anatoli Sakhnik

unread,
Jul 24, 2010, 3:47:49 PM7/24/10
to vim_dev


On 24 Лип, 15:41, Tony Mechelynck <antoine.mechely...@gmail.com>
wrote:
>
> Hm, what are the answers to each of the following in Vim running in
> gnome-terminal?
>
>         :verbose set enc? tenc? term? t_ts? title? titlestring?
encoding=utf-8
Востаннє змінена у ~/.vimrc (eng: Last changed in)
termencoding=utf-8
Востаннє змінена у ~/.vimrc (eng: Last changed in)
term=xterm
t_ts=^[]2;
title
titlestring=

>         :lang cty
Мова (ctype ): "uk_UA.utf8" (eng: Language)

>         :echo has('title')
1

>         :echo has('X11')
1

>         :echo has('xterm_save')
0

>
> Does anything change if (assuming bash shell) you do
>
>         unset LC_ALL LC_CTYPE
>         export LANG=uk_UA.utf-8
>
> either before starting gnome-terminal (but in the same shell or a parent
> shell), or before starting Vim? You may want to check that
> 'fileencodings' (plural) is appropriately set, maybe something like

No, I don't see any difference.

>
> > How shall we fix this?
>
> I don't know (unless the above helps you); but maybe Bram (or someone)
> might have an idea. As a temporary workaround, maybe either
>
>         :set notitle
> or
>         :set title titlestring=Термінал
>
> but the latter may fail if 'encoding' is different from the charset
> defined by the $LC_CTYPE set by your OS.
>

I have a quite suitable workaround for the nearest time. Let the bash
set the title from PS1 to ensure the title is ASCII. So whenever Vim
is started, oldtitle will be remembered and restored on exit
correctly. I'll give it a try to fix this bug a bit later.

Anatoli

James Vega

unread,
Jul 25, 2010, 1:10:57 PM7/25/10
to vim_dev
On Sat, Jul 24, 2010 at 02:36:50AM -0700, Anatoli Sakhnik wrote:
> Now I know what happens, and this is a bug either of vim or of gnome-
> terminal. I traced the code from :quit, and noticed the following
> calls: mch_exit() -> mch_restore_title() -> mch_settitle(). Beeps are
> produced by the strings oldtitle and oldicon, which are filled with
> garbage. So the real evil happens in function get_x11_thing, which
> can't deal with my LOCALIZED gnome-terminal. I use Ukrainian language
> in the GUI, so the title is Ukrainian "Термінал".
>
> How shall we fix this?

This sounds very similar to a bug that was reported in Debian[0].
I just had a chance to look through the patch and it looks like the
right fix to me. See if it fixes your problem.

[0]: http://bugs.debian.org/558153
--
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jame...@jamessan.com>

multibyte-title.diff
signature.asc

Bram Moolenaar

unread,
Jul 25, 2010, 4:33:26 PM7/25/10
to James Vega, vim_dev

James Vega wrote:

> On Sat, Jul 24, 2010 at 02:36:50AM -0700, Anatoli Sakhnik wrote:
> > Now I know what happens, and this is a bug either of vim or of gnome-
> > terminal. I traced the code from :quit, and noticed the following
> > calls: mch_exit() -> mch_restore_title() -> mch_settitle(). Beeps are
> > produced by the strings oldtitle and oldicon, which are filled with
> > garbage. So the real evil happens in function get_x11_thing, which
> > can't deal with my LOCALIZED gnome-terminal. I use Ukrainian language

> > in the GUI, so the title is Ukrainian "Термінал".


> >
> > How shall we fix this?
>
> This sounds very similar to a bug that was reported in Debian[0].
> I just had a chance to look through the patch and it looks like the
> right fix to me. See if it fixes your problem.
>
> [0]: http://bugs.debian.org/558153

For me it was not sufficient. I also had to use the other function for
XA_STRING. I added a check for 'encoding' to be a multi-byte encoding,
hopefully that covers all normal use cases.

I also had a problem with ":set titlestring=foo", but that turned out to
be an xterm setting (by default it expects latin1, even when everything
else is utf-8). Setting the utf8Title property fixed that.

--
Living on Earth includes an annual free trip around the Sun.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Bram Moolenaar

unread,
Jul 25, 2010, 1:59:49 PM7/25/10
to James Vega, vim_dev

James Vega wrote:

> On Sat, Jul 24, 2010 at 02:36:50AM -0700, Anatoli Sakhnik wrote:
> > Now I know what happens, and this is a bug either of vim or of gnome-
> > terminal. I traced the code from :quit, and noticed the following
> > calls: mch_exit() -> mch_restore_title() -> mch_settitle(). Beeps are
> > produced by the strings oldtitle and oldicon, which are filled with
> > garbage. So the real evil happens in function get_x11_thing, which
> > can't deal with my LOCALIZED gnome-terminal. I use Ukrainian language

> > in the GUI, so the title is Ukrainian "Термінал".


> >
> > How shall we fix this?
>
> This sounds very similar to a bug that was reported in Debian[0].
> I just had a chance to look through the patch and it looks like the
> right fix to me. See if it fixes your problem.
>
> [0]: http://bugs.debian.org/558153

I'll check it out.


--
If you only have a hammer, you tend to see every problem as a nail.
If you only have MS-Windows, you tend to solve every problem by rebooting.

Reply all
Reply to author
Forward
0 new messages