diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2026-09-02 12:23:56 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2026-09-10 06:37:01 +0000 |
| commit | 92c61ec9b1cef3bf6d1da01db3310daff6bba522 (patch) | |
| tree | 74af2be8ae1d81fc5b84b48a9cff87bce35e29dc /selection.c | |
| parent | selection: don't include spacer pad cells when extending the selection to cover all of a multi-ce... (diff) | |
selection: don't allow the start/end-points to be inside spacer pad cells
Having the start/end-points in the pad area made the spacer cells
tracking points when reflowing the grid. This caused the spacer cells
to be kept, instead of removed.
Diffstat (limited to 'selection.c')
| -rw-r--r-- | selection.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/selection.c b/selection.c index 1a4e22ea..1c432e75 100644 --- a/selection.c +++ b/selection.c @@ -1256,6 +1256,19 @@ selection_update(struct terminal *term, int col, int row) const struct row *row_end = term->grid->rows[end_row_idx]; /* + * Don't allow leading/trailing pad cells in the selection. Pull + * the start/endpoint that is inside the pad region into the + * multi-cell character, and then let the next step below move it + * to the beginning of the multi-cell character. + */ + while (unlikely(row_start->cells[new_start.col].wc == CELL_SPACER)) { + new_start.col--; + } + while (unlikely(row_end->cells[new_end.col].wc == CELL_SPACER)) { + new_end.col--; + } + + /* * If an end point is in the middle of a multi-column character, * expand the selection to cover the entire character. * |
