diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2022-04-27 16:44:57 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2022-04-27 16:44:57 +0000 |
| commit | 76305104486a90c2320dd102c32fe26831ebb658 (patch) | |
| tree | 08df2b587e5d06034ca7da4861f15f5ea77d72f0 /selection.h | |
| parent | Disable debug logging (diff) | |
selection: find_word_boundary_right: add “stop-on-space-to-word-boundary”
When true, selection_find_word_boundary_right() behaves as before - it
stops as soon as it encounters a character that isn’t of the
same *type* as the “initial” character (the last character in the
selection).
Take this, for example:
The Quick Brown Fox
The selection will first stop at the end of “the”, then just *before*
“quick”, then at the end of “quick”. Then just *before* “brown”, and
then at the end of “brown”, and so on.
This suits mouse selections pretty good. But when
selection_find_word_boundary_right() is used to extend a search match,
it’s better to ignore space-to-word character transitions. That is, we
want
The Quick Brown Fox
to first extend to the end of “the”, then immediately to the end of
“quick”, then to the end of “brown”, and so on.
Setting the ‘stop_to_space_to_word_boundary’ argument to false results
in latter behavior.
This is now done by search, when executing the
“extend-to-word-boundary” and “extend-to-next-whitespace” key
bindings.
Diffstat (limited to 'selection.h')
| -rw-r--r-- | selection.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/selection.h b/selection.h index 0a6ece91..3d0c224e 100644 --- a/selection.h +++ b/selection.h @@ -78,7 +78,8 @@ void selection_stop_scroll_timer(struct terminal *term); void selection_find_word_boundary_left( struct terminal *term, struct coord *pos, bool spaces_only); void selection_find_word_boundary_right( - struct terminal *term, struct coord *pos, bool spaces_only); + struct terminal *term, struct coord *pos, bool spaces_only, + bool stop_on_space_to_word_boundary); struct coord selection_get_start(const struct terminal *term); struct coord selection_get_end(const struct terminal *term); |
