summaryrefslogtreecommitdiff
path: root/src/internal.h
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-13 14:46:44 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-13 14:46:44 +0300
commit1e69599900a753e2d7275d7ba714202b7d9c843e (patch)
tree13416f651319145aa5dbdd85b9947bec4858b366 /src/internal.h
parent5ab6b560e8528c27ba934b90f94b1828b7771e27 (diff)
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
Diffstat (limited to 'src/internal.h')
-rw-r--r--src/internal.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/internal.h b/src/internal.h
index dd4649c..979883e 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -335,6 +335,15 @@ static inline uint32_t term_flags_pad(const struct term *t)
return term_current_flags(t) | ((uint32_t)t->cur_link << 16);
}
+static inline struct text_pen term_text_pen(const struct term *t)
+{
+ return (struct text_pen){
+ .fg = TERM_EXPECT(t->inverse, 0) ? t->cur_bg : t->cur_fg,
+ .bg = TERM_EXPECT(t->inverse, 0) ? t->cur_fg : t->cur_bg,
+ .sl = term_flags_pad(t),
+ };
+}
+
static inline void term_tabs_clear(struct term *t)
{
memset(t->tabs, 0, (size_t)t->tabs_cap);