From af6a37b1c4509c7766933a7cb45d2ee9a3a23f98 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Thu, 15 Oct 2026 11:37:31 +0300 Subject: Return owned text and share cell attribute flags with snapshots Make text queries return allocated strings released with term_text_free, keeping each capture atomic. Align public attributes with the write core, remove snapshot conversion tables, and migrate tests and the Kitty adapter. --- tests/helpers/term_api.h | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'tests/helpers/term_api.h') diff --git a/tests/helpers/term_api.h b/tests/helpers/term_api.h index bfa8d71..f2d6a5d 100644 --- a/tests/helpers/term_api.h +++ b/tests/helpers/term_api.h @@ -137,35 +137,18 @@ static inline void tt_select(struct term *t, int x1, int y1, int x2, int y2) /* NULL when nothing is selected. */ static inline char *tt_selection_text(const struct term *t) { - size_t n = term_selection_text(t, NULL, 0); - if (!n) - return NULL; - char *text = malloc(n + 1); - if (text) - term_selection_text(t, text, n + 1); - return text; + return term_selection_text(t); } static inline char *tt_history_text(struct term *t, int max_rows) { - size_t n = term_history_text(t, max_rows, NULL, 0); - char *text = malloc(n + 1); - if (text) - term_history_text(t, max_rows, text, n + 1); - return text; + return term_history_text(t, max_rows); } /* NULL when there is no link. */ static inline char *tt_link_at(struct term *t, int col, int row) { - struct term_vector2i cell = { .x = col, .y = row }; - size_t n = term_link_at(t, cell, NULL, 0); - if (!n) - return NULL; - char *url = malloc(n + 1); - if (url) - term_link_at(t, cell, url, n + 1); - return url; + return term_link_at(t, (struct term_vector2i){ .x = col, .y = row }); } static inline bool tt_resize(struct term *t, int cols, int rows) -- cgit v1.2.3