mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
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:
parent
1dd142aeab
commit
20f0334e13
6 changed files with 68 additions and 38 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue