aboutsummaryrefslogtreecommitdiff
path: root/search.c
diff options
context:
space:
mode:
authorAdrian fxj9a <af24@tuta.io>2025-03-03 13:27:30 +0000
committerDaniel Eklöf <daniel@ekloef.se>2025-03-05 07:48:23 +0000
commit6d39f66eb7c0cafb9e12be7da6831598c6dd4afb (patch)
tree3ca3de19f31f8c2c205216ab2e275c41f2d2aff2 /search.c
parentterm: reset the grapheme clustering state on cursor movements (diff)
config: add search-bindings.delete-to-{start,end} key bindings
Defaults to ctrl+u and ctrl+k respectively. Closes #1972
Diffstat (limited to 'search.c')
-rw-r--r--search.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/search.c b/search.c
index 20990c87..dda84e6d 100644
--- a/search.c
+++ b/search.c
@@ -1265,6 +1265,29 @@ 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) {
+ term->search.buf[term->search.cursor] = '\0';
+ 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)) {