summaryrefslogtreecommitdiff
path: root/src/screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/screen.c')
-rw-r--r--src/screen.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/screen.c b/src/screen.c
index d0f573c..fbfebfc 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -91,7 +91,7 @@ static void screen_push_row_inner(struct term *t, struct srow *row)
if (fill > 0) {
text_row_unshare(tr);
memset(tr->text + tr->text_len, ' ', (size_t)fill);
- text_commit(row, fill, fill, fill, HLINE_NARROW, tr->fill.fg, tr->fill.bg, 0);
+ text_commit(row, fill, fill, fill, HLINE_NARROW, (struct text_pen){ tr->fill.fg, tr->fill.bg, 0 });
}
term_hist_push_text(&t->hist, tr, wrapped);
return;
@@ -193,22 +193,20 @@ const struct cell *term_screen_view_row(const struct term *t, int y)
{
if (!t || y < 0 || y >= t->rows)
return NULL;
- uint64_t id;
- int seg, scr_y;
- if (term_hist_view_row_pos(&t->view, &t->hist, t->cols, t->rows, screen_top_line(t), y,
- &id, &seg, &scr_y)) {
+ struct hist_view_pos pos;
+ if (term_hist_view_row_pos(&t->view, &t->hist, t->cols, t->rows, screen_top_line(t), y, &pos)) {
struct cell *out = t->view_row_scratch;
- int got = term_hist_decode_segment(&t->hist, id, seg, t->cols, out, t->gstore);
+ int got = term_hist_decode_segment(&t->hist, pos.id, pos.seg, t->cols, out, t->gstore);
if (got < t->cols) {
fill_cells(out + got, t->cols - got, TERM_COLOR_FG, TERM_COLOR_BG);
- int line_rows = term_hist_line_rows(&t->hist, id, t->cols);
- if (seg + 1 < line_rows || (id + 1 == hist_end_id(&t->hist) && hist_is_open(&t->hist)))
+ int line_rows = term_hist_line_rows(&t->hist, pos.id, t->cols);
+ if (pos.seg + 1 < line_rows || (pos.id + 1 == hist_end_id(&t->hist) && hist_is_open(&t->hist)))
set_cells_wrap_pad(out + got, t->cols - got);
}
return out;
}
const struct screen *s = term_active_screen(t);
- struct srow *srow = screen_row_at(s, scr_y);
+ struct srow *srow = screen_row_at(s, pos.screen_y);
if (!srow)
return NULL;
struct cell *out = t->view_row_scratch;
@@ -237,18 +235,16 @@ uint64_t term_screen_view_row_key(const struct term *t, int y)
{
if (!t || y < 0 || y >= t->rows)
return 0;
- uint64_t id;
- int seg, scr_y;
- if (term_hist_view_row_pos(&t->view, &t->hist, t->cols, t->rows, screen_top_line(t), y,
- &id, &seg, &scr_y)) {
- uint64_t line_ver = (id + 1 == hist_end_id(&t->hist) && hist_is_open(&t->hist))
- ? (term_hist_line_cells(&t->hist, id) << 32) : 0;
- if (id == t->hist.base_cell_id)
+ struct hist_view_pos pos;
+ if (term_hist_view_row_pos(&t->view, &t->hist, t->cols, t->rows, screen_top_line(t), y, &pos)) {
+ uint64_t line_ver = (pos.id + 1 == hist_end_id(&t->hist) && hist_is_open(&t->hist))
+ ? (term_hist_line_cells(&t->hist, pos.id) << 32) : 0;
+ if (pos.id == t->hist.base_cell_id)
line_ver ^= mix64(t->hist.base_cell);
- return mix64(((uint64_t)id << 16) ^ (uint64_t)seg ^ line_ver ^ 0x517cc1b727220a95ull);
+ return mix64(((uint64_t)pos.id << 16) ^ (uint64_t)pos.seg ^ line_ver ^ 0x517cc1b727220a95ull);
}
const struct screen *s = term_active_screen(t);
- const struct srow *row = screen_row_at(s, scr_y);
+ const struct srow *row = screen_row_at(s, pos.screen_y);
if (!row)
return 0;
return mix64(row->uid ^ ((uint64_t)row->version << 32));