aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCismonX <admin@cismon.net>2026-07-31 04:49:51 +0000
committerDaniel Eklöf <daniel@ekloef.se>2026-08-06 10:44:04 +0000
commit919e06c8438bbbc9b214f2caacfe14ea031844e3 (patch)
tree5f317ddc45cb303c0de862938174abb047c79755
parentunicode: update data files to Unicode 17 (no actual changes) (diff)
selection: check column when updating selection
Selection coordinates may appear outside of the terminal grid (e.g., during the "fast resize" stage of delayed resize), resulting in bad width passed to pixman_region32_union_rect().
-rw-r--r--selection.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/selection.c b/selection.c
index 818a6834..554d61b4 100644
--- a/selection.c
+++ b/selection.c
@@ -795,10 +795,12 @@ pixman_region_for_coords_normal(const struct terminal *term,
if (rel_start_row < rel_end_row) {
/* First partial row (start ->)*/
- pixman_region32_union_rect(
- &region, &region,
- start->col, rel_start_row,
- term->cols - start->col, 1);
+ if (term->cols > start->col) {
+ pixman_region32_union_rect(
+ &region, &region,
+ start->col, rel_start_row,
+ term->cols - start->col, 1);
+ }
/* Full rows between start and end */
if (rel_start_row + 1 < rel_end_row) {
@@ -816,10 +818,12 @@ pixman_region_for_coords_normal(const struct terminal *term,
} else if (rel_start_row > rel_end_row) {
/* First partial row (end ->) */
- pixman_region32_union_rect(
- &region, &region,
- end->col, rel_end_row,
- term->cols - end->col, 1);
+ if (term->cols > end->col) {
+ pixman_region32_union_rect(
+ &region, &region,
+ end->col, rel_end_row,
+ term->cols - end->col, 1);
+ }
/* Full rows between end and start */
if (rel_end_row + 1 < rel_start_row) {