Re: [dev] Some questions about st and a patch

From: Aurélien Aptel <>
Date: Tue, 18 Oct 2011 12:14:06 +0200

On Mon, Oct 17, 2011 at 5:06 PM, Connor Lane Smith <> wrote:
> I'm not a st developer, but I've had a look at this. Arrow keys do
> need to be handled in a special way, but the arrow keys don't work
> with any modifier keys.
> Currently st handles an arrow key by printing, eg, "\033[D". With
> shift it is "\033[1;2D", with alt "\033[1;3D", and so on. So it needs
> to detect bucky bits and react accordingly.

Unfortunately, it's not that simple.
Modifiers in terminals are handled differently in each terminal.
Sometime they are added as a parameter, sometime it's a key on its
Start cat with no argument and try pressing any combination of
modifier with any arrow key in xterm and urxvt.
note: ^[ is \033 aka ESC

It seems that ncurses (which is maintained by xterm folks mind you)
doesn't even try to handle this clusterfuck [1].

On Mon, Oct 17, 2011 at 5:20 PM, Stephen Paul Weber
<> wrote:
> Excellent! I shoved this in st.c for now:
> <snip>
> And it works! :D

It works in irssi? This is weird.
I've attached a patch to handle modifiers like xterm. Of course
modified arrow keys still don't work in emacs... Ugh. This is really
Can anyone please try it with his favourite modifed-arrow-key-using
software with TERM=st and TERM=xterm?

$ hg clone
$ patch -p1 < xterm-arrow-keys.diff
$ make
$ ./st
(in st window) TERM=xterm yourapp
or, for TERM=st-xxx
(in st window) yourapp


Received on Tue Oct 18 2011 - 12:14:06 CEST

This archive was generated by hypermail 2.3.0 : Tue Oct 18 2011 - 12:24:05 CEST