mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
search: implement move cursor word backward/forward
This commit is contained in:
parent
64460c5abe
commit
0fceed6f00
1 changed files with 18 additions and 0 deletions
18
search.c
18
search.c
|
|
@ -328,11 +328,29 @@ search_input(struct terminal *term, uint32_t key, xkb_keysym_t sym, xkb_mod_mask
|
|||
term->search.cursor--;
|
||||
}
|
||||
|
||||
else if ((mods == ctrl && sym == XKB_KEY_Left) ||
|
||||
(mods == alt && sym == XKB_KEY_b))
|
||||
{
|
||||
size_t diff = distance_prev_word(term);
|
||||
term->search.cursor -= diff;
|
||||
assert(term->search.cursor >= 0);
|
||||
assert(term->search.cursor <= term->search.len);
|
||||
}
|
||||
|
||||
else if (mods == 0 && sym == XKB_KEY_Right) {
|
||||
if (term->search.cursor < term->search.len)
|
||||
term->search.cursor++;
|
||||
}
|
||||
|
||||
else if ((mods == ctrl && sym == XKB_KEY_Right) ||
|
||||
(mods == alt && sym == XKB_KEY_f))
|
||||
{
|
||||
size_t diff = distance_next_word(term);
|
||||
term->search.cursor += diff;
|
||||
assert(term->search.cursor >= 0);
|
||||
assert(term->search.cursor <= term->search.len);
|
||||
}
|
||||
|
||||
else if ((mods == 0 && sym == XKB_KEY_Home) ||
|
||||
(mods == ctrl && sym == XKB_KEY_a))
|
||||
term->search.cursor = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue