diff options
Diffstat (limited to 'Src/Zle/zle_keymap.c')
-rw-r--r-- | Src/Zle/zle_keymap.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c index 13fd13844..04eb70675 100644 --- a/Src/Zle/zle_keymap.c +++ b/Src/Zle/zle_keymap.c @@ -135,7 +135,10 @@ mod_export HashTable keymapnamtab; /**/ char *keybuf; -static int keybuflen, keybufsz = 20; +/**/ +int keybuflen; + +static int keybufsz = 20; /* last command executed with execute-named-command */ @@ -1322,15 +1325,15 @@ default_bindings(void) amap->first[i] = refthingy(t_undefinedkey); /* safe fallback keymap: - * 0-255 self-insert, except: * - * '\n' accept-line * - * '\r' accept-line */ + * 0-255 .self-insert, except: * + * '\n' .accept-line * + * '\r' .accept-line */ for (i = 0; i < 256; i++) - smap->first[i] = refthingy(t_selfinsert); - unrefthingy(t_selfinsert); - unrefthingy(t_selfinsert); - smap->first['\n'] = refthingy(t_acceptline); - smap->first['\r'] = refthingy(t_acceptline); + smap->first[i] = refthingy(t_Dselfinsert); + unrefthingy(t_Dselfinsert); + unrefthingy(t_Dselfinsert); + smap->first['\n'] = refthingy(t_Dacceptline); + smap->first['\r'] = refthingy(t_Dacceptline); /* vt100 arrow keys are bound by default, for historical reasons. * * Both standard and keypad modes are supported. */ @@ -1366,6 +1369,8 @@ default_bindings(void) bindkey(vismap, "\33", refthingy(t_deactivateregion), NULL); bindkey(vismap, "o", refthingy(t_exchangepointandmark), NULL); bindkey(vismap, "p", refthingy(t_putreplaceselection), NULL); + bindkey(vismap, "u", refthingy(t_vidowncase), NULL); + bindkey(vismap, "U", refthingy(t_viupcase), NULL); bindkey(vismap, "x", refthingy(t_videlete), NULL); bindkey(vismap, "~", refthingy(t_vioperswapcase), NULL); @@ -1374,8 +1379,12 @@ default_bindings(void) bindkey(amap, "ge", refthingy(t_vibackwardwordend), NULL); bindkey(amap, "gE", refthingy(t_vibackwardblankwordend), NULL); bindkey(amap, "gg", refthingy(t_beginningofbufferorhistory), NULL); + bindkey(amap, "gu", refthingy(t_vidowncase), NULL); + bindkey(amap, "gU", refthingy(t_viupcase), NULL); bindkey(amap, "g~", refthingy(t_vioperswapcase), NULL); bindkey(amap, "g~~", NULL, "g~g~"); + bindkey(amap, "guu", NULL, "gugu"); + bindkey(amap, "gUU", NULL, "gUgU"); /* emacs mode: arrow keys */ add_cursor_key(emap, TCUPCURSOR, t_uplineorhistory, 'A'); @@ -1615,11 +1624,18 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp) else lastchar = lastc; if(lastlen != keybuflen) { + /* + * We want to keep only the first lastlen bytes of the key + * buffer in the key buffer that were marked as used by the key + * binding above, and make the rest available for input again. + * That rest (but not what we are keeping) needs to be + * unmetafied. + */ unmetafy(keybuf + lastlen, &keybuflen); ungetbytes(keybuf+lastlen, keybuflen); if(vichgflag) - vichgbufptr -= keybuflen; - keybuf[lastlen] = 0; + curvichg.bufptr -= keybuflen; + keybuf[keybuflen = lastlen] = 0; } *funcp = func; *strp = str; |