aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-07-28 16:56:28 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-07-28 19:05:06 +0000
commit632c4839cdb1c673bfb3903e1d43802bfdcbf03f (patch)
treed1488db231973906994cf4391e8e75abf5c5cc99
parentconfig: add colors.search-box-{no-,}match (diff)
search: find_next(): handle trailing SPACER cells
Make sure to increment match_end_col to account for trailing SPACER cells after a match. This fixes an issue where search matches weren’t highlighted correctly when the match *ends* with a double-width character.
-rw-r--r--CHANGELOG.md2
-rw-r--r--search.c3
2 files changed, 5 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 55961c88..75950976 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -94,6 +94,8 @@
* Certain dead-key combinations resulting in different escape
sequences compared to kitty, when the kitty keyboard protocol is
used ([#1120][1120]).
+* Search matches ending with a double-width character not being
+ highlighted correctly.
[1055]: https://codeberg.org/dnkl/foot/issues/1055
[1092]: https://codeberg.org/dnkl/foot/issues/1092
diff --git a/search.c b/search.c
index f6d377ea..88bc88aa 100644
--- a/search.c
+++ b/search.c
@@ -371,6 +371,9 @@ find_next(struct terminal *term, enum search_direction direction,
i += additional_chars;
match_len += additional_chars;
match_end_col++;
+
+ while (match_row->cells[match_end_col].wc > CELL_SPACER)
+ match_end_col++;
}
if (match_len != term->search.len) {