mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-20 01:40:14 -05:00
search: map ctrl+shift+w to match to end of word, spaces only
This works just like ctrl+w, except that the only space separating characters are whitespaces.
This commit is contained in:
parent
867cac4207
commit
0982210af2
2 changed files with 12 additions and 4 deletions
|
|
@ -124,6 +124,11 @@ available:
|
|||
of the word, or the next word if currently at a word separating
|
||||
character.
|
||||
|
||||
* <kbd>ctrl</kbd>+<kbd>shift</kbd><kbd>w</kbd>
|
||||
|
||||
Same as <kbd>ctrl</kbd>+<kbd>w</kbd>, except that the only word
|
||||
separating characters are whitespace characters.
|
||||
|
||||
* <kbd>escape</kbd>, <kbd>ctrl</kbd>+<kbd>g</kbd>
|
||||
|
||||
Cancel the search
|
||||
|
|
|
|||
11
search.c
11
search.c
|
|
@ -265,7 +265,7 @@ search_find_next(struct terminal *term)
|
|||
}
|
||||
|
||||
static void
|
||||
search_match_to_end_of_word(struct terminal *term)
|
||||
search_match_to_end_of_word(struct terminal *term, bool spaces_only)
|
||||
{
|
||||
if (term->search.match_len == 0)
|
||||
return;
|
||||
|
|
@ -299,7 +299,7 @@ search_match_to_end_of_word(struct terminal *term)
|
|||
bool done = false;
|
||||
for (; end_col < term->cols; end_col++) {
|
||||
wchar_t wc = row->cells[end_col].wc;
|
||||
if (wc == 0 || (!first && !isword(wc, false))) {
|
||||
if (wc == 0 || (!first && !isword(wc, spaces_only))) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -396,7 +396,7 @@ search_input(struct terminal *term, uint32_t key, xkb_keysym_t sym, xkb_mod_mask
|
|||
|
||||
const xkb_mod_mask_t ctrl = 1 << term->wl->kbd.mod_ctrl;
|
||||
const xkb_mod_mask_t alt = 1 << term->wl->kbd.mod_alt;
|
||||
//const xkb_mod_mask_t shift = 1 << term->wl->kbd.mod_shift;
|
||||
const xkb_mod_mask_t shift = 1 << term->wl->kbd.mod_shift;
|
||||
//const xkb_mod_mask_t meta = 1 << term->wl->kbd.mod_meta;
|
||||
|
||||
enum xkb_compose_status compose_status = xkb_compose_state_get_status(
|
||||
|
|
@ -544,7 +544,10 @@ search_input(struct terminal *term, uint32_t key, xkb_keysym_t sym, xkb_mod_mask
|
|||
}
|
||||
|
||||
else if (mods == ctrl && sym == XKB_KEY_w)
|
||||
search_match_to_end_of_word(term);
|
||||
search_match_to_end_of_word(term, false);
|
||||
|
||||
else if (mods == (ctrl | shift) && sym == XKB_KEY_W)
|
||||
search_match_to_end_of_word(term, true);
|
||||
|
||||
else {
|
||||
uint8_t buf[64] = {0};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue