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 337252 - ALT + Arrow keys don't work in irssi through gnome-terminal
ALT + Arrow keys don't work in irssi through gnome-terminal
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
unspecified
Other All
: Normal minor
: ---
Assigned To: VTE Maintainers
VTE Maintainers
: 434921 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-04-04 19:55 UTC by Matthew East
Modified: 2011-04-13 15:01 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
Do as xterm does *now* (678 bytes, patch)
2006-08-29 21:19 UTC, Mariano Suárez-Alvarez
committed Details | Review
Change to CSI if SS3 with modifier (654 bytes, patch)
2007-05-07 22:58 UTC, James Bowes
none Details | Review
Only switch to CSI for some cursor keys when in cursor app mode (2.40 KB, patch)
2007-05-08 23:29 UTC, James Bowes
committed Details | Review

Description Matthew East 2006-04-04 19:55:29 UTC
Please describe the problem:
I use irssi in gnome-terminal. The ALT+arrow keys (left/right) are supposed to
change window in that direction, but they don't work in gnome-terminal. It works
in other terminals (I use rxvt-unicode), and is a very useful functionality.
Please add this functionality!! If it can be done for 2.14.1, that will make my
year.

Matt

Steps to reproduce:
1. 
2. 
3. 


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Mariano Suárez-Alvarez 2006-08-29 21:17:56 UTC
An age ago, Nalin commited this <http://cvs.gnome.org/viewcvs/vte/src/keymap.c?r1=1.14&r2=1.15>: this was suggested by <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=177745>, which shows that at that time Shift+Left was making xterm feed the client «^[[2B» while vte was feeding it «^[[1;2B». 

After that, xterm was changed so that it emits «^[[1;2B»... Cf. <
http://dickey.his.com/xterm/xterm.log.html#xterm_167>.

So vte should be changed back to the original code.

It's fun implementing a moving target, no?
Comment 2 Mariano Suárez-Alvarez 2006-08-29 21:19:00 UTC
Created attachment 71870 [details] [review]
Do as xterm does *now*

Luckily, Nalin did not remove the «correct» code!
Comment 3 Behdad Esfahbod 2006-08-29 22:57:58 UTC
Heh.  Would be useful to add a comment around there.
Comment 4 Mariano Suárez-Alvarez 2006-10-11 04:46:05 UTC
Fixed in HEAD:

2006-10-11  Mariano Suárez-Alvarez  <msuarezalvarez@arnet.com.ar>

        Bug 337252 – ALT + Arrow keys don't work in irssi through gnome-terminal

        * src/keymap.c (_vte_keymap_key_add_key_modifiers): Match the (newer)
        xterm behavior when reporting modifiers to things running in a terminal.

Comment 5 Jürg Billeter 2006-12-07 07:49:10 UTC
This modified/broke Ctrl + Left/Right (for backward/forward-word) with gnome-terminal on my system in various places

- plain bash (readline): fixed by switching to "\e[1;5C" resp. "\e[1;5D" in inputrc
- bash (readline) within screen: don't know how to fix that, works fine with xterm
- vi: don't know how to fix that, doesn't seem to do the right thing with xterm either

Could anybody please explain what problem should be corrected where (or revert the patch)? Also, what is the terminal standard vte is trying to follow, any references?
Comment 6 Mariano Suárez-Alvarez 2006-12-07 15:36:37 UTC
Hm, I can reproduce that for your cases 2 and 3 (Fedora's /etc/inputrc already has "\e[1;5C" and friend. I get the correct behaviour inside vim with xterm, too.

I'll try to see what screen and vim are doing here (they tend to do very, very ugly termcap hacks...) If you feel like it, you could run bash+screen and vi inside script and look at what they are sending

As for your last question: there is really no standard. There is ECMA-48 (a.k.a. 6429) (along with ISO-2022 (aka ECMA-35), ISO-4873 (a.k.a. ECMA-43)...). There are the various DEC manuals for the original terminals (you can get them from here <http://vt100.net/>). And there is the xterm source (which changes over time). vte is an xterm emulator.

(There are also several `standards' that specify how (small parts of) terminal behaviour are exposed to applications: cf. termcap and terminfo.)
Comment 7 Daniel Holbach 2007-01-12 10:26:35 UTC
Any chance of fixing this somehow? Can't we keep the fix for alt-arrow and make the old ctrl-arrow behaviour work again?
Comment 8 Behdad Esfahbod 2007-01-12 18:22:14 UTC
Mariano, can you fix this soonish?  It's kinda late in the cycle..

Thanks.
Comment 9 Mariano Suárez-Alvarez 2007-01-16 08:53:11 UTC
I think is is due to the fact that we are sending control sequences for the cursors, when in Application Cursor Mode, which start SS3 but which have parameters. In particular, in ACM, the cursor keys + Control are sending «SS3 1 ; 5 D» (with SS3 encoded as ESC 0) while xterm sends «CSI 1 ; 5 D» 

xterm used to behave as vte does now (up to the other issue we solved a while back, another change in xterm...) before <http://cvsweb.xfree86.org/cvsweb/xc/programs/xterm/input.c.diff?r1=3.57&r2=3.58> got applied.

I can't see how to fix this right now easily, but it may well be I'm just tired...
Comment 10 Chris Wilson 2007-04-26 19:37:35 UTC
Also see bug 310305
Comment 11 James Bowes 2007-05-07 22:58:53 UTC
Created attachment 87756 [details] [review]
Change to CSI if SS3 with modifier

Here's a patch that seems to work for me, mirroring the change to xterm that Mariano mentioned in comment #9.
Comment 12 James Bowes 2007-05-08 23:29:49 UTC
Created attachment 87843 [details] [review]
Only switch to CSI for some cursor keys when in cursor app mode

The previous patch I sent wasn't exact enough. This one should send the same codes that xterm does.

However, alt+arrow keys don't work in xterm right now anyways (version 225). But at least this patch gets vte and xterm working the same ;)
Comment 14 Loïc Minier 2007-06-20 07:17:23 UTC
*** Bug 434921 has been marked as a duplicate of this bug. ***
Comment 15 Loïc Minier 2007-07-25 09:32:45 UTC
Patch seems to work fine here; I've uploaded it to Debian due to some complaints that Ctrl-arrows or Shift-arrows didn't work in vim to move between words and that Ctrl-Shift-arrows didn't work in vim to move between tabs.
Comment 16 Behdad Esfahbod 2007-07-27 04:45:33 UTC
2007-07-27  Behdad Esfahbod  <behdad@gnome.org>

        Bug 337252 – ALT + Arrow keys don't work in irssi through gnome-terminal
        Patch by James Bowes

        * src/keymap.c (_vte_keymap_map), (is_cursor_key),
        (_vte_keymap_key_add_key_modifiers):
        * src/keymap.h:
        * src/vte.c (vte_terminal_key_press):
        Only switch to CSI for some cursor keys when in cursor app mode.