GNOME Bugzilla – Bug 337252
ALT + Arrow keys don't work in irssi through gnome-terminal
Last modified: 2011-04-13 15:01:15 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:
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?
Created attachment 71870 [details] [review] Do as xterm does *now* Luckily, Nalin did not remove the «correct» code!
Heh. Would be useful to add a comment around there.
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.
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?
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.)
Any chance of fixing this somehow? Can't we keep the fix for alt-arrow and make the old ctrl-arrow behaviour work again?
Mariano, can you fix this soonish? It's kinda late in the cycle.. Thanks.
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...
Also see bug 310305
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.
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 ;)
Please also have a look at: http://bugzilla.gnome.org/show_bug.cgi?id=425462 and http://bugzilla.gnome.org/show_bug.cgi?id=418732
*** Bug 434921 has been marked as a duplicate of this bug. ***
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.
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.