config: add mouse specific bind actions

This extends the "normal" bind action enum with mouse specific
actions.

When parsing key bindings, we only check up to the last valid keyboard
binding, while mouse bindings support *both* key actions and mouse
actions.

The new actions are:

* select-begin: starts an interactive selection
* select-extend: interactively extend an existing selection
* select-word: select word under cursor
* select-word-whitespace: select word under cursor, where the only
  word separating characters are whitespace characters.

The old hard-coded selection "bindings" have been converted to instead
use these actions, via default bindings added to the configuration.
This commit is contained in:
Daniel Eklöf 2020-08-11 09:55:33 +02:00
parent 1dd142aeab
commit 20f0334e13
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
6 changed files with 68 additions and 38 deletions

View file

@ -237,6 +237,7 @@ selection_start(struct terminal *term, int col, int row,
term->selection.kind = kind;
term->selection.start = (struct coord){col, term->grid->view + row};
term->selection.end = (struct coord){-1, -1};
term->selection.ongoing = true;
}
static bool
@ -566,6 +567,11 @@ selection_finalize(struct seat *seat, struct terminal *term, uint32_t serial)
if (term->selection.start.row < 0 || term->selection.end.row < 0)
return;
if (!term->selection.ongoing)
return;
term->selection.ongoing = false;
assert(term->selection.start.row != -1);
assert(term->selection.end.row != -1);
@ -600,6 +606,7 @@ selection_cancel(struct terminal *term)
term->selection.start = (struct coord){-1, -1};
term->selection.end = (struct coord){-1, -1};
term->selection.direction = SELECTION_UNDIR;
term->selection.ongoing = false;
}
void