From 1e69599900a753e2d7275d7ba714202b7d9c843e Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Tue, 13 Oct 2026 14:46:44 +0300 Subject: Eliminate pen style and history stream parameter smuggling - Introduce struct text_pen bundling (fg, bg, sl) across screen and core - Reduce text_append from 9 to 7 parameters - Reduce text_commit from 8 to 6 parameters - Reduce hist_runs_add_pen from 5 to 3 parameters - Reduce sc_text_ascii and sc_ascii_fast from 6 to 4 parameters - Remove unused fg, bg parameters from mark_row_blank - Introduce struct hist_stream_state in src/hist.c, reducing stream_lines from 9 to 5 params and lf_rows from 10 to 6 params - Introduce struct hist_view_pos in src/hist_view.h, reducing term_hist_view_row_pos from 9 to 7 params --- src/selection.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/selection.c') diff --git a/src/selection.c b/src/selection.c index b05a43c..4602d8f 100644 --- a/src/selection.c +++ b/src/selection.c @@ -281,14 +281,16 @@ static uint32_t line_seg_start_off(const struct lines *L, uint64_t id, int seg) static bool view_row_line(const struct lines *L, int y, uint64_t *id, int *seg) { const struct term *t = L->t; - int y_scr; - if (term_hist_view_row_pos(&t->view, &t->hist, L->cols, t->rows, screen_top_line(t), y, - id, seg, &y_scr)) + 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)) { + *id = pos.id; + *seg = pos.seg; return true; - if (y_scr >= lines_rows(L)) - y_scr = lines_rows(L) - 1; - *id = L->pos[y_scr].id; - *seg = (int)L->pos[y_scr].seg; + } + if (pos.screen_y >= lines_rows(L)) + pos.screen_y = lines_rows(L) - 1; + *id = L->pos[pos.screen_y].id; + *seg = (int)L->pos[pos.screen_y].seg; return true; } -- cgit v1.2.3