aboutsummaryrefslogtreecommitdiff
path: root/search.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-05-14 12:41:02 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-05-14 12:41:02 +0000
commitd9e1aefb9173857f0632227de5ac368a505c69bf (patch)
tree0801f95aa3d86f607889148c4649be2e1a2ef612 /search.c
parentgrid: add compile-time define to enable timing of the reflow operation (diff)
term: rename CELL_MULT_COL_SPACER -> CELL_SPACER, and change its definition
Instead of using CELL_SPACER for *all* cells that previously used CELL_MULT_COL_SPACER, include the remaining number of spacers following, and including, itself. This is encoded by adding to the CELL_SPACER value. So, a double width character will now store the character itself in the first cell (just like before), and CELL_SPACER+1 in the second cell. A three-cell character would store the character itself, then CELL_SPACER+2, and finally CELL_SPACER+1. In other words, the last spacer is always CELL_SPACER+1. CELL_SPACER+0 is used when padding at the right margin. I.e. when writing e.g. a double width character in the last column, we insert a CELL_SPACER+0 pad character, and then write the double width character in the first column on the next row.
Diffstat (limited to 'search.c')
-rw-r--r--search.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/search.c b/search.c
index 02cea9e0..911b13c0 100644
--- a/search.c
+++ b/search.c
@@ -337,7 +337,7 @@ search_find_next(struct terminal *term)
row = term->grid->rows[end_row];
}
- if (row->cells[end_col].wc == CELL_MULT_COL_SPACER) {
+ if (row->cells[end_col].wc >= CELL_SPACER) {
end_col++;
continue;
}
@@ -461,7 +461,7 @@ search_match_to_end_of_word(struct terminal *term, bool spaces_only)
bool done = false;
for (; end_col < term->cols; end_col++) {
wchar_t wc = row->cells[end_col].wc;
- if (wc == CELL_MULT_COL_SPACER)
+ if (wc >= CELL_SPACER)
continue;
const struct composed *composed = NULL;