summaryrefslogtreecommitdiff
path: root/tests/helpers/term_api.h
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-15 11:37:31 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-15 11:37:31 +0300
commitaf6a37b1c4509c7766933a7cb45d2ee9a3a23f98 (patch)
treee7b0294ebf0d9b124b8885a76c119d7f46d5b0fb /tests/helpers/term_api.h
parentacd338ea33de36d223cc6d301712eed4a9501e6c (diff)
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.
Diffstat (limited to 'tests/helpers/term_api.h')
-rw-r--r--tests/helpers/term_api.h23
1 files changed, 3 insertions, 20 deletions
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)