From 027ef55842c36b1b6182ebe334a92e402e39e54e Mon Sep 17 00:00:00 2001 From: 0WD0 Date: Thu, 18 Jun 2026 21:50:59 +0800 Subject: ime: refresh search matches after IME commit The IME commit handler appended text to the search buffer and refreshed the search box, but never called search_find_next(). CJK input into scrollback search therefore showed no match until another key press re-triggered the regular search input path. Call search_find_next() in the commit branch, and apply the same fix to unicode-mode.c. To allow this, search_find_next() is no longer static. --- ime.c | 1 + search.c | 2 +- search.h | 1 + unicode-mode.c | 5 +++-- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ime.c b/ime.c index c6ccb479..fa0e2cee 100644 --- a/ime.c +++ b/ime.c @@ -200,6 +200,7 @@ done(void *data, struct zwp_text_input_v3 *zwp_text_input_v3, if (term != NULL) { if (term->is_searching) { search_add_chars(term, text, len); + search_find_next(term, SEARCH_BACKWARD_SAME_POSITION); render_refresh_search(term); } else term_to_slave(term, text, len); diff --git a/search.c b/search.c index ef0a15bb..92815591 100644 --- a/search.c +++ b/search.c @@ -424,7 +424,7 @@ find_next(struct terminal *term, enum search_direction direction, return false; } -static void +void search_find_next(struct terminal *term, enum search_direction direction) { struct grid *grid = term->grid; diff --git a/search.h b/search.h index ee8ecd76..69d6e600 100644 --- a/search.h +++ b/search.h @@ -14,6 +14,7 @@ void search_input( const xkb_keysym_t *raw_syms, size_t raw_count, uint32_t serial); void search_add_chars(struct terminal *term, const char *text, size_t len); +void search_find_next(struct terminal *term, enum search_direction direction); void search_selection_cancelled(struct terminal *term); diff --git a/unicode-mode.c b/unicode-mode.c index 99a7293d..81f92451 100644 --- a/unicode-mode.c +++ b/unicode-mode.c @@ -57,9 +57,10 @@ unicode_mode_input(struct seat *seat, struct terminal *term, term->unicode_mode.character, (int)chars, utf8); if (chars != (size_t)-1) { - if (term->is_searching) + if (term->is_searching) { search_add_chars(term, utf8, chars); - else + search_find_next(term, SEARCH_BACKWARD_SAME_POSITION); + } else term_to_slave(term, utf8, chars); } -- cgit v1.3