selection: foreach: don't call callback for trailing multi-character cells

This commit is contained in:
Daniel Eklöf 2020-07-14 12:59:36 +02:00
parent 7d134e6b1c
commit 3bc404b5a3
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -135,6 +135,8 @@ foreach_selected_normal(
c++)
{
cb(term, row, &row->cells[c], c, data);
c += max(1, wcwidth(row->cells[c].wc)) - 1;
assert(c < term->cols);
}
start_col = 0;
@ -165,8 +167,11 @@ foreach_selected_block(
struct row *row = term->grid->rows[real_r];
assert(row != NULL);
for (int c = top_left.col; c <= bottom_right.col; c++)
for (int c = top_left.col; c <= bottom_right.col; c++) {
cb(term, row, &row->cells[c], c, data);
c += max(1, wcwidth(row->cells[c].wc)) - 1;
assert(c < term->cols);
}
}
}