aboutsummaryrefslogtreecommitdiff
path: root/keymap.h (unfollow)
Commit message (Collapse)AuthorLines
2026-04-17keymap: no reason keypad keys shouldn't map shiftDaniel Eklöf-22/+0
I'm guessing, but I'm not sure, that when I initially implemented this, XTerm ignored shift in keypad escapes. Testing again, it doesn't. And regardless of what XTerm does, I don't really see any reason to exclude shift from keypad escapes. Closes #2324
2022-07-28keymap: change alt+escape to emit \E\E instead of a CSI 27 sequenceDaniel Eklöf-1/+1
Closes #1105
2022-02-01keymap: alt-tab (C-tab) now emits “ESC tab” by defaultDaniel Eklöf-1/+2
In our default mode (roughly equivalent to XTerm’s modifyOtherKeys=1), alt-tab now emits ESC-tab instead of CSI 27;3;9~. When modifyOtherKeys=2 is enabled (CSI >4;2m), alt-tab emits the “old” CSI 27 escape. This better matches XTerm’s behavior. Note that other alt-tab combos are ambiguous in XTerm, and thus they are left unchanged here (i.e. we keep emitting CSI 27 escapes for them). Closes #900
2021-11-13input: add support for modifyOtherKeys=2Daniel Eklöf-18/+38
Similar to modifyOtherKeys=1 (foot’s default, and only, mode), except that: * All modifiers (and not just Ctrl) generate \E[27;m;n~ escapes * Regular keys (with modifiers) also generate \E[27;m;n~ escapes (for example, C-h no longer generates ^H, but \E[27;5;104~) For our keymap based lookups, this is handled by adding MOD_MODIFY_OTHER_KEYS_STATE<N> variants. For “generic” keys, we simply adjust the conditions for when to emit a \E[27;m;n~ escape - the only requirement is that at least one modifier is active.
2021-05-26keymap: iso_left_tab: we no longer “consume” shift when matchingDaniel Eklöf-11/+9
Thus, the modifier list needs to include MOD_SHIFT, or we wont match anything, causing us to hit the last entry, \E[Z. Closes #547
2021-03-08keymap: handle shift+tab combos correctly, after consuming modifiersDaniel Eklöf-0/+19
Shift+Tab is an odd bird in XKB; it produces a shifted variant of tab, ISO_Left_Tab, with Shift being a consumed modifier. From a terminal perspective, Tab and ISO_Left_Tab are the same key, with Shift+Tab generating ‘CSI Z’, and all other combos generating a ‘CSI 27;mods;9~’ escape. Before, when we didn’t filter out consumed modifiers, we could simply re-use the keymap for Tab when translating ISO_Left_Tab. This is no longer possible, since shift has been filtered out. As a result, Shift+Tab no longer generated ‘CSI Z’, but ‘\t’. I.e as if shift wasn’t being pressed. This patch adds a separate keymap table for ISO_Left_Tab. It’s MOD_ANY entry corresponds to Shift+Tab, and emits ‘CSI Z’. All its other entries *exclude* shift (since it has been consumed), *but*, the encoded modifier (in the escape sequences) *include* shift.
2020-12-01keymap: add ‘CSI 27;<mod>;27~’ escapes for Esc with modifiersDaniel Eklöf-0/+15
2020-12-01keymap: fix alt+return combosDaniel Eklöf-11/+11
All alt+return combos mapped to the same escape sequence as alt+return itself. With this patch, alt+<mod(s)>+return map to a standard ‘CSI 27;x;13~’ sequence.
2020-12-01keymap: use same lookup table for Tab and ISO_Left_TabDaniel Eklöf-5/+1
With XKB, Shift+Tab maps to XKB_KEY_ISO_Left_Tab, not XKB_Key_Tab. Previously, we had two different lookup tables for the two. The tab table was correctly populated, while the ISO-left tab wasn’t. As a result, all Shift+Tab combos (except Shift+Tab itself) was wrong, and resulted in the same escape sequence as Shift+Tab. Fix by using the same table for both tab and ISO-left tab. Closes #210
2020-11-28keymap: add ‘CSI 27;<mod>;27~’ escapes for Esc with modifiersDaniel Eklöf-0/+15
2020-11-19keymap: fix alt+return combosDaniel Eklöf-11/+11
All alt+return combos mapped to the same escape sequence as alt+return itself. With this patch, alt+<mod(s)>+return map to a standard ‘CSI 27;x;13~’ sequence.
2020-11-19keymap: use same lookup table for Tab and ISO_Left_TabDaniel Eklöf-5/+1
With XKB, Shift+Tab maps to XKB_KEY_ISO_Left_Tab, not XKB_Key_Tab. Previously, we had two different lookup tables for the two. The tab table was correctly populated, while the ISO-left tab wasn’t. As a result, all Shift+Tab combos (except Shift+Tab itself) was wrong, and resulted in the same escape sequence as Shift+Tab. Fix by using the same table for both tab and ISO-left tab. Closes #210
2020-10-10selection: use appropriate check for PRIMARY pasteSergey Nazaryev-81/+54
Assume it could be a copy-paste typo. We should check PRIMARY, not CLIPBOARD. Without this fix, we can't use PRIMARY until we copy anything to CLIPBOARD.
2020-09-07keymap: emit \E[27;2;13~ for all key combinations involving Shift+ReturnDaniel Eklöf-4/+11
This is what XTerm emits with `modifyOtherKeys=1`, which is foot’s only mode.
2020-06-27input: add key mapping for XKB_KEY_KP_DecimalDaniel Eklöf-0/+1
2020-04-08keymap: remove trailing whitespacesDaniel Eklöf-7/+7
2020-04-08keymap: return: all Alt+<mod> now emits \e\rDaniel Eklöf-2/+9
2020-04-08keymap: \t -> spacesDaniel Eklöf-1/+1
2020-03-16Make Alt-Return send ESC ReturnMichael Cardell Widerkrantz-0/+1
2020-02-21keymap: tab: handle all modifiersDaniel Eklöf-2/+17
Tab is one of the keys included in our "otherModifierKeys" implementation. However, since the key sym falls outside the checks required to trigger it, special case it and implement its sequences as a table.
2020-02-21keymap: align backspace escapes with XTermDaniel Eklöf-3/+16
Backspace now emits DEL for all non-ctrl modifier combos, and BS for all ctrl modifier combos. The alt modifier prefixes DEL/BS with ESC. This also removes my own hack of mapping ctrl+backspace to alt+backspace. Describe backspace behavior in both the README and the man page. TODO: implement DECBKM to allow applications to toggle the backspace behavior.
2020-01-11keymap: remove keymap tableDaniel Eklöf-89/+0
Lookup is now done in code, using a switch-statement
2020-01-11keymap: add KP enterDaniel Eklöf-0/+2
This makes the keypad enter key emit "\eOM" in keypad application mode.
2020-01-10keymap: add escapes for keypad 'begin'Daniel Eklöf-0/+7
This is usually the '5' key, in non-num lock mode.
2019-08-15keymap: add meta modifier mappings for keypad keysDaniel Eklöf-191/+64
2019-08-15keymap: add meta modifier mappings for non-keypad keysDaniel Eklöf-154/+60
2019-08-15input: track meta modifierDaniel Eklöf-0/+1
2019-08-15keymap: don't ESC prefix return when 'shift' is held downDaniel Eklöf-1/+0
2019-07-22keymap: fix sequences for PageDownDaniel Eklöf-7/+7
2019-07-18keymap: map tab and back-tabDaniel Eklöf-0/+11
2019-07-17keymap: use hex instead of octalDaniel Eklöf-3/+3
2019-07-09input: fix backspace escape sequencesDaniel Eklöf-3/+3
2019-07-09input: split up keymapDaniel Eklöf-381/+560
This makes the top level table smaller, and faster to search through. Eventually, we could do something fancy, like b-search the top level table.
2019-07-09input: implement keypad application modeDaniel Eklöf-0/+454
This commit also replaces the previous (temporary) key map with a much more complete one.