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_
diff -r e9fd465c5dac st.c
--- a/st.c      Sun Jul 31 11:18:06 2011 +0200
+++ b/st.c      Mon Aug 01 11:55:14 2011 +0200
@@ -1834,7 +1834,7 @@
 kmap(KeySym k, unsigned int state) {
        int i;
        for(i = 0; i < LEN(key); i++)
-               if(key[i].k == k && (key[i].mask == 0 || key[i].mask & state))
+               if(key[i].k == k && (state + key[i].mask == 0 || key[i].mask & 
state))
                        return (char*)key[i].s;
        return NULL;
 }

Reply via email to