st

st fork
git clone git://git.rr3.xyz/st
Log | Files | Refs | README | LICENSE

commit d290bc0791429a0cc5f9f7c3b278ac95a75ca344
parent b8cdab2b3cef56e0d20eb0efed755cac6b9d3a09
Author: robert <robertrussell.72001@gmail.com>
Date:   Mon, 27 Dec 2021 17:38:32 -0800

Fix some key handling

Diffstat:
Mconfig.def.c | 43+++++++++++++++++++++----------------------
Mconfig.def.h | 2+-
Mx.c | 3++-
3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/config.def.c b/config.def.c @@ -167,28 +167,27 @@ Btn btns[] = { /* TODO: add RELS to clr */ Key keys[] = { /* Shortcuts (must be first to get precedence) */ - { XK_Home, TERMMOD, KEXCL(TERMMOD), zoomrst, ARG_DUMMY }, - { XK_Prior, TERMMOD, KEXCL(TERMMOD), zoomrel, {.d = +1} }, - { XK_Next, TERMMOD, KEXCL(TERMMOD), zoomrel, {.d = -1} }, - { XK_Print, C, KEXCL(C), togprinter, ARG_DUMMY }, - { XK_Print, S, KEXCL(S), printscreen, ARG_DUMMY }, - { XK_Print, 0, 0, selprint, ARG_DUMMY }, - { XK_Insert, S, KEXCL(S), selpaste, ARG_DUMMY }, - { XK_Break, 0, 0, sendbreak, ARG_DUMMY }, - { XK_Num_Lock, TERMMOD, KEXCL(TERMMOD), numlock, ARG_DUMMY }, - { XK_C, TERMMOD, KEXCL(TERMMOD), clipcopy, ARG_DUMMY }, - { XK_V, TERMMOD, KEXCL(TERMMOD), clippaste, ARG_DUMMY }, - { XK_Y, TERMMOD, KEXCL(TERMMOD), selpaste, ARG_DUMMY }, - - /* Latin1 special cases (kpress handles most cases already) */ - { XK_space, C, KEXCL(C), SENDSTR("\0") }, - { XK_space, C|A, KEXCL(C|A), SENDSTR("\033\0") }, - { XK_at, C, 0, SENDUNICODE('@') }, /* '@'-64 is NUL */ - { XK_O, A, 0, SENDUNICODE('O') }, /* ESC O is SS3 */ - { XK_i, C, 0, SENDUNICODE('i') }, /* 'i'-64 is tab */ - { XK_m, C, 0, SENDUNICODE('m') }, /* 'm'-64 is CR */ - { XK_bracketleft, C, 0, SENDUNICODE('[') }, /* '['-64 is ESC */ - { XK_bracketleft, A, 0, SENDUNICODE('[') }, /* ESC [ is CSI */ + { XK_Home, TERMMOD, KEXCL(TERMMOD), zoomrst, ARG_DUMMY }, + { XK_Prior, TERMMOD, KEXCL(TERMMOD), zoomrel, {.d = +1} }, + { XK_Next, TERMMOD, KEXCL(TERMMOD), zoomrel, {.d = -1} }, + { XK_Print, C, KEXCL(C), togprinter, ARG_DUMMY }, + { XK_Print, S, KEXCL(S), printscreen, ARG_DUMMY }, + { XK_Print, 0, 0, selprint, ARG_DUMMY }, + { XK_Insert, S, KEXCL(S), selpaste, ARG_DUMMY }, + { XK_Break, 0, 0, sendbreak, ARG_DUMMY }, + { XK_Num_Lock, TERMMOD, KEXCL(TERMMOD), numlock, ARG_DUMMY }, + { XK_C, TERMMOD, KEXCL(TERMMOD), clipcopy, ARG_DUMMY }, + { XK_V, TERMMOD, KEXCL(TERMMOD), clippaste, ARG_DUMMY }, + { XK_Y, TERMMOD, KEXCL(TERMMOD), selpaste, ARG_DUMMY }, + + /* ASCII special cases (kpress handles most cases already) */ + { XK_space, S, 0, SENDCSI(' ',0,'u') }, + { XK_space, C, KEXCL(C), SENDSTR("\0") }, + { XK_space, C|A, KEXCL(C|A), SENDSTR("\033\0") }, + { XK_O, A, 0, SENDUNICODE('O') }, /* ESC O is SS3 */ + { XK_i, C, 0, SENDUNICODE('i') }, /* 'i'-0x60 is tab */ + { XK_m, C, 0, SENDUNICODE('m') }, /* 'm'-0x60 is CR */ + { XK_bracketleft, A, 0, SENDUNICODE('[') }, /* ESC [ is CSI */ /* Misc */ { XK_BackSpace, 0, KMOD, SENDSTR("\177") }, diff --git a/config.def.h b/config.def.h @@ -30,7 +30,7 @@ typedef union { } str; struct { uint n; /* First parameter; ignored if 0 or 1 */ - uint m; /* State mask */ + uint m; /* State bits to ignore when encoding as CSI */ char c; } csi; } Arg; diff --git a/x.c b/x.c @@ -1713,7 +1713,8 @@ handlesym(KeySym sym, uint state) /* 2. Printable ASCII (some special cases are handled in the keys table) */ if (0x20 <= sym && sym < 0x7f) { - /* CTRL + [ALT +] non-lowercase-letter must be encoded as CSI */ + /* CTRL + [ALT +] non-lowercase-letter must be encoded as CSI + * XXX some of these should probably be mapped to C0 controls */ if ((state&CTRL) > 0 && !('a' <= sym && sym <= 'z')) { len = csienc(buf, sizeof buf, state, sym, SHFT, 'u'); } else {