dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit c38c27b0b738f5012baf6bd9599ff4d8b9779e7e
parent 95c8e2101db4976f0c3ae84340748c50e8e6138a
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Tue, 19 Apr 2016 17:54:55 +0200

Make it possible to set MOD to Ctrl-Space

Ctrl-Space is a bit special in that it maps to 0 (zero) which is
also used as an array terminator.

Ctrl-Space can be set as default modifier in config.h by defining:

 #define MOD CTRL(' ')

or at run time with:

 $ dvtm -m '^ '

Close #24

Diffstat:
dvtm.c | 13+++++--------
1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/dvtm.c b/dvtm.c @@ -750,10 +750,7 @@ resize_screen(void) { } static KeyBinding* -keybinding(KeyCombo keys) { - unsigned int keycount = 0; - while (keycount < MAX_KEYS && keys[keycount]) - keycount++; +keybinding(KeyCombo keys, unsigned int keycount) { for (unsigned int b = 0; b < LENGTH(bindings); b++) { for (unsigned int k = 0; k < keycount; k++) { if (keys[k] != bindings[b].keys[k]) @@ -1788,10 +1785,10 @@ main(int argc, char *argv[]) { if (code == KEY_MOUSE) { key_index = 0; handle_mouse(); - } else if ((binding = keybinding(keys))) { - unsigned int key_length = 0; - while (key_length < MAX_KEYS && binding->keys[key_length]) - key_length++; + } else if ((binding = keybinding(keys, key_index))) { + unsigned int key_length = MAX_KEYS; + while (key_length > 1 && !binding->keys[key_length-1]) + key_length--; if (key_index == key_length) { binding->action.cmd(binding->action.args); key_index = 0;