From 6d2dc774947787dcef73a3251d1e9ec51bc526df Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Thu, 15 Oct 2026 12:42:11 +0300 Subject: Report selection allocation failure instead of truncating On a screen taller than 256 rows the selection's row list is allocated. When that failed, it fell back to the 256-entry stack array, so the selection and the snapshot's selection spans silently stopped at row 256 while every call still reported success. lines_init() now reports the failure. term_select_start() and term_select_extend() return false and leave the selection unchanged, term_snapshot_update() fails and keeps its previous content, and the text getters return NULL, as they do for their other allocations. Co-Authored-By: Claude Opus 5.5 --- src/screen.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/screen.h') diff --git a/src/screen.h b/src/screen.h index 0bd95c0..df464a7 100644 --- a/src/screen.h +++ b/src/screen.h @@ -18,7 +18,8 @@ void term_screen_insert_chars(struct term *t, int count); const struct cell *term_screen_view_row(const struct term *t, int y); uint64_t term_screen_view_row_key(const struct term *t, int y); /* The selected columns [c0, c1] of each view row; c1 < c0 when none. */ -void term_selection_view_spans(const struct term *t, int *c0, int *c1); +/* False when memory runs out; c0 and c1 are then not complete. */ +bool term_selection_view_spans(const struct term *t, int *c0, int *c1); int term_screen_history_rows(const struct term *t); -- cgit v1.2.3