After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 160134 - mouse events occurring past column 95 are not passed through to terminal application
mouse events occurring past column 95 are not passed through to terminal appl...
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
0.11.x
Other Linux
: High normal
: ---
Assigned To: Behdad Esfahbod
VTE Maintainers
: 317663 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-12-01 20:27 UTC by Robert Day
Modified: 2006-04-20 11:01 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
A text file that can be used to recreate the bug. (5.91 KB, text/plain)
2004-12-01 20:28 UTC, Robert Day
  Details
Patch to allow mouse to be used on terminals with more than 95 columns (1.87 KB, patch)
2006-04-18 07:57 UTC, Sean Estabrooks
committed Details | Review

Description Robert Day 2004-12-01 20:27:30 UTC
Open a gnome-terminal with more than 95 columns.
Open vim (I have 6.2.98) on a file with lines longer than 95 characters.
In vim, set the options:
    :set mouse=a
    :set nowrap
Click and drag to visually select some text. If you drag past column 95, the
mouse movement is ignored, until you drag back to the left of column 95. If you
start the click-and-drag after column 95, it is completely ignored.

This occurs at column 95 with both smaller and larger fonts.

In an xterm (version 179), this does not occur.
Comment 1 Robert Day 2004-12-01 20:28:42 UTC
Created attachment 34378 [details]
A text file that can be used to recreate the bug.
Comment 2 Mariano Suárez-Alvarez 2004-12-01 23:14:23 UTC
I can reproduce this with vim, but not with pico, which hints that this may be
NOTGNOME. Maybe you can look into vim's source and see what it is doing when
it's handling mouse events? 
Comment 3 Robert Day 2004-12-02 14:44:54 UTC
I do not have pico, but I can reproduce it with lynx (a text-based browser,
version 2.8.5) using the text file that I attached:
> lynx -use_mouse dimensions.txt

The middle mouse button brings up a text menu in lynx, but not after column 95.
Also, if the text menu straddles column 95, then clicking a menu item on or
before column 95 works, but clicking after column 95 does not work.

The bug does not occur using xterm (v 179) or KDE's konsole (from KDE 3.1).

So I have:
        gnome-terminal    xterm    konsole
vim         BUG             OK       OK
lynx        BUG             OK       OK
Comment 4 Mariano Suárez-Alvarez 2004-12-03 01:06:08 UTC
This is due to the fact that everything vte sends to the child is recoded from
UTF-8 to the encoding the child expects, and column numbers for mouse events are
encoded in a char (after adding 32). Now 95+32=127, so anything after column 95
ends up being a byte which is not proper UTF-8, and vte just drops the whole string.

One simple fix might be add a boolean parameter to vte_terminal_feed_child which
controls whether recoding will take place, and use it to mark the string sent by
vte_terminal_send_mouse_button_internal as not recodable. It's be smarter to
have a different function to do this, I guess.

¡Yay for a protocol that breaks for > 255 columns!

Moving to vte, where this will happen.
Comment 5 Egmont Koblinger 2005-01-08 12:45:23 UTC
¡Yay for a protocol that breaks for > 223 (255-32) columns! :)

Actually, xterm is also buggy in case a non-UTF-8 locale with "*locale: true"
is used, in this case xterm uses a standalone child process (luit) to convert
the whole stream...
Comment 6 Olav Vitters 2005-11-17 17:16:45 UTC
*** Bug 317663 has been marked as a duplicate of this bug. ***
Comment 7 Behdad Esfahbod 2005-11-17 20:36:13 UTC
Can't we encode it as valid UTF8?  like gunichar->utf8 conversion.
Comment 8 Egmont Koblinger 2005-11-19 13:59:24 UTC
No, I don't think so. Applications wouldn't recognize it.
Comment 9 Egmont Koblinger 2005-11-21 13:19:36 UTC
IMHO the best would be to create some new escape sequence for mouse clicks that
 - is valid utf-8 (the best is if it's 7-bit clean)
 - supports arbitrary terminal size
and then include support for it in ncurses/slang and the well-known terminals,
and slowly migrate from this old brain-damaged escape sequence to the new
scheme.
If anybody knows the proper forum where such things can be requested and
discussed, please tell me. :)
Comment 10 Behdad Esfahbod 2005-11-21 13:24:57 UTC
Try:

http://mail.nl.linux.org/linux-utf8/
Comment 11 Sean Estabrooks 2006-04-18 07:57:40 UTC
Created attachment 63776 [details] [review]
Patch to allow mouse to be used on terminals with more than 95 columns

This patch changes the mouse code to send protocol data as binary rather than UTF-8, so that the range isn't limited to 95 columns.
Comment 12 Egmont Koblinger 2006-04-18 10:20:00 UTC
I tested it with vte-0.12.0 in both UTF-8 and iso8859-2 mode, and it seems
to be fine. Thanks!
Comment 13 Olav Vitters 2006-04-18 12:08:52 UTC
Sean: Haven't tested yet, but your patch is really appreciated!!
Comment 14 Behdad Esfahbod 2006-04-20 11:01:48 UTC
Thanks.  Committed after making it a public function and renaming to vte_terminal_feed_child_binary, and updating docs and Python bindings.

2006-04-20  Behdad Esfahbod  <behdad@gnome.org>

        * doc/reference/tmpl/internals.sgml:
        * doc/reference/tmpl/reaper.sgml:
        * doc/reference/tmpl/vte-unused.sgml:
        * doc/reference/tmpl/vte.sgml:
        * doc/reference/tmpl/vteaccess.sgml:
        * doc/reference/vte-sections.txt: Misc fixes and updates.

        * python/vte.defs:
        * python/vte.override: Updates.

        Bug 160134 – mouse events occurring past column 95 are not passed
        through to terminal application
        Based on patch from Sean Estabrooks.

        * src/vte.h:
        * src/vte.c (vte_terminal_feed_child_binary): New public function.

        * src/vte.c (vte_terminal_send_mouse_button_internal),
        (vte_terminal_maybe_send_mouse_drag): Use feed_child_binary.