aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-12-03 19:25:22 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-12-03 19:25:22 +0000
commit0f98101bbcff89be4743c5e879531ca3fd520019 (patch)
treeef5f9d58a573cfd0343ff2f9fa5042584e2cf115
parentsearch: bug: restore end-col/end-row adjustment (diff)
search: match_to_end_of_word: bug: reset end-col when bumping end-row
When we calculate the end coords, we must reset end-col when we reach the end of the line and bump the end-row. This fixes an issue where bumping the row once lead to the end row being bumped for *each* remaining match character.
-rw-r--r--search.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/search.c b/search.c
index 0000f606..cfd339a6 100644
--- a/search.c
+++ b/search.c
@@ -281,8 +281,10 @@ search_match_to_end_of_word(struct terminal *term, bool spaces_only)
/* Calculate end coord - note: assumed to be valid */
for (size_t i = 0; i < len; i++) {
- if (++end_col >= term->cols)
+ if (++end_col >= term->cols) {
end_row = (end_row + 1) % term->grid->num_rows;
+ end_col = 0;
+ }
}
tll(wchar_t) new_chars = tll_init();