summaryrefslogtreecommitdiff
path: root/src/selection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/selection.c')
-rw-r--r--src/selection.c188
1 files changed, 94 insertions, 94 deletions
diff --git a/src/selection.c b/src/selection.c
index 1d931c9..f2dbd1a 100644
--- a/src/selection.c
+++ b/src/selection.c
@@ -5,13 +5,13 @@
#include <stdlib.h>
#include <string.h>
-static char *link_at_text(const struct term *t, struct term_vector2i cell)
+static char *link_at_text(const struct wsap_vtcore *t, struct wsap_vtcore_vector2i cell)
{
int col = cell.x, row = cell.y;
if (!t || col < 0 || col >= t->cols || row < 0 || row >= t->rows) return NULL;
- const char *link = term_osc8_url_at(t, col, row);
- if (link) return term_strdup(link);
- const struct cell *cells = term_screen_view_row(t, row);
+ const char *link = wsap_vtcore_osc8_url_at(t, col, row);
+ if (link) return wsap_vtcore_strdup(link);
+ const struct cell *cells = wsap_vtcore_screen_view_row(t, row);
if (!cells) return NULL;
int start = col, end = col;
while (start > 0 && cells[start - 1].c > ' ' && cells[start - 1].c < 127) start--;
@@ -48,27 +48,27 @@ static char *link_at_text(const struct term *t, struct term_vector2i cell)
while (n && (mask[(unsigned char)url[n - 1] >> 6] & (1ULL << ((unsigned char)url[n - 1] & 63))))
url[--n] = 0;
if (col < start + (int)(url - text) + (int)n && n > scheme)
- out = term_strdup(url);
+ out = wsap_vtcore_strdup(url);
}
free(text);
return out;
}
-char *term_link_at(const struct term *t, struct term_vector2i cell)
+char *wsap_vtcore_link_at(const struct wsap_vtcore *t, struct wsap_vtcore_vector2i cell)
{
if (!t) return NULL;
- term_write_begin((struct term *)t);
+ wsap_vtcore_write_begin((struct wsap_vtcore *)t);
char *text = link_at_text(t, cell);
- term_write_end((struct term *)t);
+ wsap_vtcore_write_end((struct wsap_vtcore *)t);
return text;
}
-void term_select_clear(struct term *t)
+void wsap_vtcore_select_clear(struct wsap_vtcore *t)
{
if (t) {
- term_write_begin(t);
+ wsap_vtcore_write_begin(t);
t->selection = false;
- term_write_end(t);
+ wsap_vtcore_write_end(t);
}
}
@@ -85,7 +85,7 @@ static inline int word_class(uint32_t c)
return 1;
}
-static inline int sel_point_cmp(struct term_sel_point a, struct term_sel_point b)
+static inline int sel_point_cmp(struct wsap_vtcore_sel_point a, struct wsap_vtcore_sel_point b)
{
if (a.line_id < b.line_id) return -1;
if (a.line_id > b.line_id) return 1;
@@ -100,7 +100,7 @@ static inline int sel_point_cmp(struct term_sel_point a, struct term_sel_point b
* gives the line and segment of each screen row.
*/
struct lines {
- const struct term *t;
+ const struct wsap_vtcore *t;
int cols;
bool hist;
uint64_t hist_end;
@@ -111,7 +111,7 @@ struct lines {
/* False when a screen taller than the stack array needs memory and none is
* left. L can still be passed to lines_free(). */
-static bool lines_init(struct lines *L, const struct term *t)
+static bool lines_init(struct lines *L, const struct wsap_vtcore *t)
{
L->t = t;
L->cols = t->cols;
@@ -154,7 +154,7 @@ static inline bool is_open_line(const struct lines *L, uint64_t id)
static inline int hist_segs(const struct lines *L, uint64_t id)
{
- return in_hist(L, id) ? term_hist_line_rows(&L->t->hist, id, L->cols) : 0;
+ return in_hist(L, id) ? wsap_vtcore_hist_line_rows(&L->t->hist, id, L->cols) : 0;
}
static int screen_row_of(const struct lines *L, uint64_t id, int seg)
@@ -181,14 +181,14 @@ static int line_total_segs(const struct lines *L, uint64_t id)
static const struct cell *line_seg_cells(const struct lines *L, uint64_t id, int seg,
struct cell *scratch, bool *out_wrapped)
{
- const struct term *t = L->t;
+ const struct wsap_vtcore *t = L->t;
struct cell *buf = scratch ? scratch : t->view_row_scratch;
int hrows = hist_segs(L, id);
if (seg < hrows) {
- int got = term_hist_decode_segment(&t->hist, id, seg, L->cols, buf, t->gstore);
+ int got = wsap_vtcore_hist_decode_segment(&t->hist, id, seg, L->cols, buf, t->gstore);
bool wrapped = seg + 1 < hrows || is_open_line(L, id);
if (got < L->cols) {
- fill_cells(buf + got, L->cols - got, TERM_COLOR_FG, TERM_COLOR_BG);
+ fill_cells(buf + got, L->cols - got, WSAP_VTCORE_COLOR_FG, WSAP_VTCORE_COLOR_BG);
if (wrapped)
set_cells_wrap_pad(buf + got, L->cols - got);
}
@@ -207,7 +207,7 @@ static const struct cell *line_seg_cells(const struct lines *L, uint64_t id, int
return srow->cells;
if (srow->len > 0)
memcpy(buf, srow->cells, (size_t)srow->len * sizeof(struct cell));
- fill_cells(buf + srow->len, L->cols - srow->len, TERM_COLOR_FG, TERM_COLOR_BG);
+ fill_cells(buf + srow->len, L->cols - srow->len, WSAP_VTCORE_COLOR_FG, WSAP_VTCORE_COLOR_BG);
return buf;
}
text_row_cells(srow, buf, L->cols);
@@ -217,12 +217,12 @@ static const struct cell *line_seg_cells(const struct lines *L, uint64_t id, int
/* A line whose segments may not hold exactly cols cells each. */
static bool line_has_wide(const struct lines *L, uint64_t id)
{
- const struct term *t = L->t;
+ const struct wsap_vtcore *t = L->t;
if (in_hist(L, id)) {
- if (term_hist_line_flags(&t->hist, id) & (HLINE_HAS_WIDE | HLINE_HAS_CLUSTER))
+ if (wsap_vtcore_hist_line_flags(&t->hist, id) & (HLINE_HAS_WIDE | HLINE_HAS_CLUSTER))
return true;
if (is_open_line(L, id) &&
- term_hist_line_cells(&t->hist, id) != (uint64_t)hist_segs(L, id) * (uint64_t)L->cols)
+ wsap_vtcore_hist_line_cells(&t->hist, id) != (uint64_t)hist_segs(L, id) * (uint64_t)L->cols)
return true;
}
int rows = lines_rows(L);
@@ -254,19 +254,19 @@ static uint32_t line_seg_start_off(const struct lines *L, uint64_t id, int seg)
if (!line_has_wide(L, id))
return (uint32_t)seg * (uint32_t)L->cols;
- const struct term *t = L->t;
+ const struct wsap_vtcore *t = L->t;
int hrows = hist_segs(L, id);
if (in_hist(L, id)) {
if (seg <= hrows) {
uint64_t base = id == t->hist.base_cell_id ? t->hist.base_cell : 0;
- return (uint32_t)(term_hist_segment_cell(&t->hist, id, seg, L->cols) - base);
+ return (uint32_t)(wsap_vtcore_hist_segment_cell(&t->hist, id, seg, L->cols) - base);
}
}
uint32_t off = 0;
if (in_hist(L, id) && hrows > 0) {
uint64_t base = id == t->hist.base_cell_id ? t->hist.base_cell : 0;
- off = (uint32_t)(term_hist_segment_cell(&t->hist, id, hrows, L->cols) - base);
+ off = (uint32_t)(wsap_vtcore_hist_segment_cell(&t->hist, id, hrows, L->cols) - base);
}
struct cell stack_buf[512];
struct cell *scratch = L->cols <= 512 ? stack_buf : malloc((size_t)L->cols * sizeof(*scratch));
@@ -283,9 +283,9 @@ static uint32_t line_seg_start_off(const struct lines *L, uint64_t id, int seg)
/* The line and segment of view row y. */
static bool view_row_line(const struct lines *L, int y, uint64_t *id, int *seg)
{
- const struct term *t = L->t;
+ const struct wsap_vtcore *t = L->t;
struct hist_view_pos pos;
- if (term_hist_view_row_pos(&t->view, &t->hist, L->cols, t->rows, screen_top_line(t), y, &pos)) {
+ if (wsap_vtcore_hist_view_row_pos(&t->view, &t->hist, L->cols, t->rows, screen_top_line(t), y, &pos)) {
*id = pos.id;
*seg = pos.seg;
return true;
@@ -297,9 +297,9 @@ static bool view_row_line(const struct lines *L, int y, uint64_t *id, int *seg)
return true;
}
-static struct term_sel_point view_to_sel_point(const struct lines *L, int x, int y)
+static struct wsap_vtcore_sel_point view_to_sel_point(const struct lines *L, int x, int y)
{
- const struct term *t = L->t;
+ const struct wsap_vtcore *t = L->t;
if (x < 0) x = 0;
if (x >= L->cols) x = L->cols - 1;
if (y < 0) y = 0;
@@ -308,11 +308,11 @@ static struct term_sel_point view_to_sel_point(const struct lines *L, int x, int
uint64_t id;
int seg;
if (!view_row_line(L, y, &id, &seg))
- return (struct term_sel_point){ .line_id = L->first };
+ return (struct wsap_vtcore_sel_point){ .line_id = L->first };
const struct cell *cells = line_seg_cells(L, id, seg, NULL, NULL);
if (cells && x > 0 && (cells[x].flags & CELL_WRAP_PAD))
x--;
- return (struct term_sel_point){
+ return (struct wsap_vtcore_sel_point){
.line_id = id,
.cell_off = line_seg_start_off(L, id, seg) + (uint32_t)x,
};
@@ -328,7 +328,7 @@ static uint32_t line_total_display_cols(const struct lines *L, uint64_t id, int
return start + (uint32_t)seg_display_cols(L->cols, cells, wrapped);
}
-static struct term_sel_point sel_point_next(const struct lines *L, struct term_sel_point pt)
+static struct wsap_vtcore_sel_point sel_point_next(const struct lines *L, struct wsap_vtcore_sel_point pt)
{
int nsegs = line_total_segs(L, pt.line_id);
if (nsegs <= 0)
@@ -341,12 +341,12 @@ static struct term_sel_point sel_point_next(const struct lines *L, struct term_s
uint64_t max_id = L->pos[lines_rows(L) - 1].id;
for (uint64_t next = pt.line_id + 1; next <= max_id; next++)
if (line_total_segs(L, next) > 0)
- return (struct term_sel_point){ .line_id = next };
+ return (struct wsap_vtcore_sel_point){ .line_id = next };
pt.cell_off++;
return pt;
}
-static struct term_sel_point sel_point_prev(const struct lines *L, struct term_sel_point pt)
+static struct wsap_vtcore_sel_point sel_point_prev(const struct lines *L, struct wsap_vtcore_sel_point pt)
{
if (pt.cell_off > 0) {
pt.cell_off--;
@@ -357,36 +357,36 @@ static struct term_sel_point sel_point_prev(const struct lines *L, struct term_s
if (nsegs <= 0)
continue;
uint32_t cols = line_total_display_cols(L, prev, nsegs);
- return (struct term_sel_point){ .line_id = prev, .cell_off = cols > 0 ? cols - 1 : 0 };
+ return (struct wsap_vtcore_sel_point){ .line_id = prev, .cell_off = cols > 0 ? cols - 1 : 0 };
}
return pt;
}
static void unit_span(const struct lines *L, int x, int y, bool right_half,
- enum term_select_unit unit,
- struct term_sel_point *first, struct term_sel_point *last)
+ enum wsap_vtcore_select_unit unit,
+ struct wsap_vtcore_sel_point *first, struct wsap_vtcore_sel_point *last)
{
- const struct term *t = L->t;
+ const struct wsap_vtcore *t = L->t;
int cols = L->cols;
if (x < 0) x = 0;
if (x >= cols) x = cols - 1;
if (y < 0) y = 0;
if (y >= t->rows) y = t->rows - 1;
- if (unit == TERM_SELECT_CELL) {
- struct term_sel_point pt = view_to_sel_point(L, x, y);
+ if (unit == WSAP_VTCORE_SELECT_CELL) {
+ struct wsap_vtcore_sel_point pt = view_to_sel_point(L, x, y);
if (right_half)
pt = sel_point_next(L, pt);
*first = *last = pt;
return;
}
- if (unit == TERM_SELECT_LINE) {
+ if (unit == WSAP_VTCORE_SELECT_LINE) {
*first = view_to_sel_point(L, 0, y);
*last = sel_point_next(L, view_to_sel_point(L, cols - 1, y));
return;
}
- const struct cell *row = term_screen_view_row(t, y);
+ const struct cell *row = wsap_vtcore_screen_view_row(t, y);
if (row && x > 0 && (row[x].flags & CELL_WRAP_PAD))
x--;
int left = x, right = x;
@@ -401,16 +401,16 @@ static void unit_span(const struct lines *L, int x, int y, bool right_half,
}
/* Clamp the selection to the retained lines. A read does not change it. */
-static bool selection_bounds(const struct lines *L, struct term_sel_point *start,
- struct term_sel_point *end)
+static bool selection_bounds(const struct lines *L, struct wsap_vtcore_sel_point *start,
+ struct wsap_vtcore_sel_point *end)
{
- const struct term *t = L->t;
+ const struct wsap_vtcore *t = L->t;
if (!t->selection || t->sel_end.line_id < L->first)
return false;
*start = t->sel_start;
*end = t->sel_end;
if (start->line_id < L->first)
- *start = (struct term_sel_point){ .line_id = L->first };
+ *start = (struct wsap_vtcore_sel_point){ .line_id = L->first };
return sel_point_cmp(*start, *end) <= 0;
}
@@ -447,7 +447,7 @@ static bool line_locate_cell(const struct lines *L, uint64_t id, uint32_t cell_o
}
} else {
uint64_t base = id == L->t->hist.base_cell_id ? L->t->hist.base_cell : 0;
- int seg = term_hist_cell_segment(&L->t->hist, id, base + (uint64_t)cell_off, L->cols);
+ int seg = wsap_vtcore_hist_cell_segment(&L->t->hist, id, base + (uint64_t)cell_off, L->cols);
if (seg < hrows) {
uint32_t seg_start = line_seg_start_off(L, id, seg);
if (cell_off >= seg_start) {
@@ -479,8 +479,8 @@ static bool line_locate_cell(const struct lines *L, uint64_t id, uint32_t cell_o
return false;
}
-static void select_range(struct term *t, const struct lines *L,
- struct term_sel_point start, struct term_sel_point end)
+static void select_range(struct wsap_vtcore *t, const struct lines *L,
+ struct wsap_vtcore_sel_point start, struct wsap_vtcore_sel_point end)
{
if (sel_point_cmp(start, end) > 0) {
t->selection = false;
@@ -502,49 +502,49 @@ static void select_range(struct term *t, const struct lines *L,
t->selection = true;
}
-bool term_select_start(struct term *t, struct term_vector2i cell, bool right_half,
- enum term_select_unit unit)
+bool wsap_vtcore_select_start(struct wsap_vtcore *t, struct wsap_vtcore_vector2i cell, bool right_half,
+ enum wsap_vtcore_select_unit unit)
{
if (!t) return false;
- term_write_begin(t);
+ wsap_vtcore_write_begin(t);
struct lines L;
if (!lines_init(&L, t)) {
lines_free(&L);
- term_write_end(t);
+ wsap_vtcore_write_end(t);
return false;
}
- struct term_sel_point first, last;
+ struct wsap_vtcore_sel_point first, last;
unit_span(&L, cell.x, cell.y, right_half, unit, &first, &last);
lines_free(&L);
- enum term_select_unit old_unit = t->select_unit;
- struct term_sel_point old_first = t->sel_anchor_first, old_last = t->sel_anchor_last;
+ enum wsap_vtcore_select_unit old_unit = t->select_unit;
+ struct wsap_vtcore_sel_point old_first = t->sel_anchor_first, old_last = t->sel_anchor_last;
bool old_selection = t->selection;
t->select_unit = unit;
t->sel_anchor_first = first;
t->sel_anchor_last = last;
t->selection = false;
- bool ok = term_select_extend(t, cell, right_half);
+ bool ok = wsap_vtcore_select_extend(t, cell, right_half);
if (!ok) {
t->select_unit = old_unit;
t->sel_anchor_first = old_first;
t->sel_anchor_last = old_last;
t->selection = old_selection;
}
- term_write_end(t);
+ wsap_vtcore_write_end(t);
return ok;
}
-bool term_select_extend(struct term *t, struct term_vector2i cell, bool right_half)
+bool wsap_vtcore_select_extend(struct wsap_vtcore *t, struct wsap_vtcore_vector2i cell, bool right_half)
{
if (!t) return false;
- term_write_begin(t);
+ wsap_vtcore_write_begin(t);
struct lines L;
if (!lines_init(&L, t)) {
lines_free(&L);
- term_write_end(t);
+ wsap_vtcore_write_end(t);
return false;
}
- struct term_sel_point first, last;
+ struct wsap_vtcore_sel_point first, last;
unit_span(&L, cell.x, cell.y, right_half, t->select_unit, &first, &last);
if (sel_point_cmp(first, t->sel_anchor_first) > 0) first = t->sel_anchor_first;
if (sel_point_cmp(last, t->sel_anchor_last) < 0) last = t->sel_anchor_last;
@@ -553,21 +553,21 @@ bool term_select_extend(struct term *t, struct term_vector2i cell, bool right_ha
else
select_range(t, &L, first, sel_point_prev(&L, last));
lines_free(&L);
- term_write_end(t);
+ wsap_vtcore_write_end(t);
return true;
}
-bool term_has_selection(const struct term *t)
+bool wsap_vtcore_has_selection(const struct wsap_vtcore *t)
{
if (!t)
return false;
- term_write_begin((struct term *)t);
+ wsap_vtcore_write_begin((struct wsap_vtcore *)t);
bool has = t->selection && t->sel_end.line_id >= first_retained_line(t);
- term_write_end((struct term *)t);
+ wsap_vtcore_write_end((struct wsap_vtcore *)t);
return has;
}
-bool term_selection_view_spans(const struct term *t, int *c0, int *c1)
+bool wsap_vtcore_selection_view_spans(const struct wsap_vtcore *t, int *c0, int *c1)
{
int rows = t->rows, cols = t->cols;
for (int y = 0; y < rows; y++) {
@@ -581,7 +581,7 @@ bool term_selection_view_spans(const struct term *t, int *c0, int *c1)
lines_free(&L);
return false;
}
- struct term_sel_point start, end;
+ struct wsap_vtcore_sel_point start, end;
if (!selection_bounds(&L, &start, &end)) {
lines_free(&L);
return true;
@@ -644,8 +644,8 @@ static bool text_reserve(char **text, size_t *cap, size_t need)
return true;
}
-static char *range_text_inner(const struct term *t,
- const struct term_sel_point *bounds)
+static char *range_text_inner(const struct wsap_vtcore *t,
+ const struct wsap_vtcore_sel_point *bounds)
{
if (!t || (!bounds && !t->selection)) return NULL;
struct lines L;
@@ -653,7 +653,7 @@ static char *range_text_inner(const struct term *t,
lines_free(&L);
return NULL;
}
- struct term_sel_point start, end;
+ struct wsap_vtcore_sel_point start, end;
if (bounds) {
start = bounds[0];
end = bounds[1];
@@ -697,7 +697,7 @@ static char *range_text_inner(const struct term *t,
take = end_seg - seg + 1;
if (!batch_cells)
batch_cells = malloc((size_t)BATCH_SEGS * (size_t)t->cols * sizeof(struct cell));
- batch_len = batch_cells ? term_hist_decode_segments(&t->hist, id, batch_start, take,
+ batch_len = batch_cells ? wsap_vtcore_hist_decode_segments(&t->hist, id, batch_start, take,
t->cols, batch_cells, batch_lens,
t->gstore) : 0;
}
@@ -707,7 +707,7 @@ static char *range_text_inner(const struct term *t,
int got = batch_lens[idx];
row_wrapped = seg + 1 < hrows || is_open_line(&L, id);
if (got < t->cols) {
- fill_cells(row_buf + got, t->cols - got, TERM_COLOR_FG, TERM_COLOR_BG);
+ fill_cells(row_buf + got, t->cols - got, WSAP_VTCORE_COLOR_FG, WSAP_VTCORE_COLOR_BG);
if (row_wrapped)
set_cells_wrap_pad(row_buf + got, t->cols - got);
}
@@ -775,17 +775,17 @@ static char *range_text_inner(const struct term *t,
uint32_t cp = cells[c].c;
if (cells[c].flags & (CELL_TRAIL | CELL_WRAP_PAD))
continue;
- /* One cell expands to TERM_GRAPHEME_MAX_LEN code points of up
+ /* One cell expands to WSAP_VTCORE_GRAPHEME_MAX_LEN code points of up
* to 4 bytes each. Leave room for all of them. */
- if (!text_reserve(&text, &cap, n + (size_t)TERM_GRAPHEME_MAX_LEN * 4 + 1))
+ if (!text_reserve(&text, &cap, n + (size_t)WSAP_VTCORE_GRAPHEME_MAX_LEN * 4 + 1))
break;
if (cp > 0 && cp < 128) {
text[n++] = (char)cp;
} else {
- uint32_t cps[TERM_GRAPHEME_MAX_LEN];
- int len = term_gstore_expand(t->gstore, cp ? cp : ' ', cps, TERM_GRAPHEME_MAX_LEN);
+ uint32_t cps[WSAP_VTCORE_GRAPHEME_MAX_LEN];
+ int len = wsap_vtcore_gstore_expand(t->gstore, cp ? cp : ' ', cps, WSAP_VTCORE_GRAPHEME_MAX_LEN);
for (int k = 0; k < len; k++)
- n += (size_t)term_utf8_encode(cps[k], text + n);
+ n += (size_t)wsap_vtcore_utf8_encode(cps[k], text + n);
}
}
if (text && !is_last && !wrapped && text_reserve(&text, &cap, n + 2))
@@ -799,34 +799,34 @@ static char *range_text_inner(const struct term *t,
return text;
}
-char *term_history_text(struct term *t, int max_rows)
+char *wsap_vtcore_history_text(struct wsap_vtcore *t, int max_rows)
{
if (!t)
return NULL;
- term_write_begin(t);
- term_hist_prepare_rows(&t->hist, t->cols);
- if (!term_hist_view_sync(&t->view, &t->hist, t->cols)) {
- term_write_end(t);
+ wsap_vtcore_write_begin(t);
+ wsap_vtcore_hist_prepare_rows(&t->hist, t->cols);
+ if (!wsap_vtcore_hist_view_sync(&t->view, &t->hist, t->cols)) {
+ wsap_vtcore_write_end(t);
return NULL;
}
- int end_row = term_screen_history_rows(t) - term_view_offset(t);
+ int end_row = wsap_vtcore_screen_history_rows(t) - wsap_vtcore_view_offset(t);
if (max_rows <= 0 || end_row <= 0) {
- term_write_end(t);
- return term_strdup("");
+ wsap_vtcore_write_end(t);
+ return wsap_vtcore_strdup("");
}
int begin_row = end_row > max_rows ? end_row - max_rows : 0;
struct lines L;
if (!lines_init(&L, t)) {
lines_free(&L);
- term_write_end(t);
+ wsap_vtcore_write_end(t);
return NULL;
}
- struct term_sel_point bounds[2] = {0};
+ struct wsap_vtcore_sel_point bounds[2] = {0};
int first_seg, last_seg;
char *text = NULL;
- if (term_hist_view_find_row(&t->view, &t->hist, begin_row, t->cols,
+ if (wsap_vtcore_hist_view_find_row(&t->view, &t->hist, begin_row, t->cols,
&bounds[0].line_id, &first_seg) &&
- term_hist_view_find_row(&t->view, &t->hist, end_row - 1, t->cols,
+ wsap_vtcore_hist_view_find_row(&t->view, &t->hist, end_row - 1, t->cols,
&bounds[1].line_id, &last_seg)) {
bounds[0].cell_off = line_seg_start_off(&L, bounds[0].line_id, first_seg);
uint32_t last_start = line_seg_start_off(&L, bounds[1].line_id, last_seg);
@@ -846,15 +846,15 @@ char *term_history_text(struct term *t, int max_rows)
}
}
lines_free(&L);
- term_write_end(t);
+ wsap_vtcore_write_end(t);
return text;
}
-char *term_selection_text(const struct term *t)
+char *wsap_vtcore_selection_text(const struct wsap_vtcore *t)
{
if (!t) return NULL;
- term_write_begin((struct term *)t);
+ wsap_vtcore_write_begin((struct wsap_vtcore *)t);
char *text = range_text_inner(t, NULL);
- term_write_end((struct term *)t);
+ wsap_vtcore_write_end((struct wsap_vtcore *)t);
return text;
}