mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-18 06:46:23 -04:00
feat(search): add delete-to-start and delete-to-end keybindings
with ctrl+u and ctrl+k respectively Ref: #1972
This commit is contained in:
parent
882f4b2468
commit
41c3d1834c
4 changed files with 35 additions and 0 deletions
27
search.c
27
search.c
|
|
@ -1265,6 +1265,33 @@ execute_binding(struct seat *seat, struct terminal *term,
|
|||
return true;
|
||||
}
|
||||
|
||||
case BIND_ACTION_SEARCH_DELETE_TO_START: {
|
||||
if (term->search.cursor > 0) {
|
||||
memmove(&term->search.buf[0],
|
||||
&term->search.buf[term->search.cursor],
|
||||
(term->search.len - term->search.cursor)
|
||||
* sizeof(char32_t));
|
||||
|
||||
term->search.len -= term->search.cursor;
|
||||
term->search.cursor = 0;
|
||||
*update_search_result = *redraw = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
case BIND_ACTION_SEARCH_DELETE_TO_END: {
|
||||
if (term->search.cursor < term->search.len) {
|
||||
memmove(&term->search.buf[term->search.cursor],
|
||||
&term->search.buf[term->search.len],
|
||||
(term->search.len + term->search.cursor - term->search.len)
|
||||
* sizeof(char32_t));
|
||||
|
||||
term->search.len = term->search.cursor;
|
||||
*update_search_result = *redraw = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
case BIND_ACTION_SEARCH_EXTEND_CHAR: {
|
||||
struct coord target;
|
||||
if (search_extend_find_char_right(term, &target)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue