[dev] [st] shift-insert patch (more general: key.mask and state)

From: <stanio_AT_cs.tu-berlin.de>
Date: Mon, 1 Aug 2011 12:14:46 +0200

Hi,

I had this issue with shift-insert not working in st which annoyed me a
lot again while setting up a new box today, so I looked into it.

`kpress` first invokes `kmap` to handle custom keys which override
default behaviour. In `kmap` this condition
        if(key[i].k == k && (key[i].mask == 0 || key[i].mask & state))
                return (char*)key[i].s;
is always met when you press a key which is defined in config.h in `key`
with 0 mask, e.g.,
        { XK_Insert, 0, "\033[2~" },

If you want to use XK_Insert with shift, you never come to the place it
is handled in `kpress`. You can remove it from `key` in config.h. This
works with minor side effects, e.g. not able to enter insert mode in vi
by pressing Insert, which I don't do anyway. Might have some effects for
Emacs users?

However, you can also check state == 0 in addition to key[i].mask == 0
in `kmap` which I guess was the intent of the inner parentheses, in
other words "Do mask and state match".

cheers,

-- 
 stanio_

Received on Mon Aug 01 2011 - 12:14:46 CEST

This archive was generated by hypermail 2.2.0 : Mon Aug 01 2011 - 12:24:02 CEST