Add a context for cell/palette/hyperlinks when drawing to tty to avoid

passing so much in parameters.
This commit is contained in:
nicm
2026-06-09 21:22:22 +00:00
parent 34dd42dc7f
commit d533d7c97c
10 changed files with 125 additions and 125 deletions

27
tmux.h
View File

@@ -1610,6 +1610,13 @@ struct tty_term {
};
LIST_HEAD(tty_terms, tty_term);
/* Terminal style context. */
struct tty_style_ctx {
const struct grid_cell *defaults;
struct colour_palette *palette;
struct hyperlinks *hyperlinks;
};
/* Client terminal. */
struct tty {
struct client *client;
@@ -1753,7 +1760,7 @@ struct tty_ctx {
/* The default colours and palette. */
struct grid_cell defaults;
struct colour_palette *palette;
struct tty_style_ctx style_ctx;
/* Containing region (usually window) offset and size. */
u_int wox;
@@ -2621,6 +2628,10 @@ void environ_push(struct environ *);
void printflike(2, 3) environ_log(struct environ *, const char *, ...);
struct environ *environ_for_session(struct session *, int);
/* tty-draw.c */
void tty_draw_line(struct tty *, struct screen *, u_int, u_int, u_int,
u_int, u_int, const struct tty_style_ctx *);
/* tty.c */
void tty_create_log(void);
int tty_window_bigger(struct tty *);
@@ -2629,8 +2640,7 @@ void tty_update_window_offset(struct window *);
void tty_update_client_offset(struct client *);
void tty_raw(struct tty *, const char *);
void tty_attributes(struct tty *, const struct grid_cell *,
const struct grid_cell *, struct colour_palette *,
struct hyperlinks *);
const struct tty_style_ctx *);
void tty_reset(struct tty *);
void tty_region_off(struct tty *);
void tty_margin_off(struct tty *);
@@ -2649,8 +2659,7 @@ void tty_puts(struct tty *, const char *);
void tty_putc(struct tty *, u_char);
void tty_putn(struct tty *, const void *, size_t, u_int);
void tty_cell(struct tty *, const struct grid_cell *,
const struct grid_cell *, struct colour_palette *,
struct hyperlinks *);
const struct tty_style_ctx *);
int tty_init(struct tty *, struct client *);
void tty_resize(struct tty *);
void tty_set_size(struct tty *, u_int, u_int, u_int, u_int);
@@ -2662,17 +2671,13 @@ void tty_stop_tty(struct tty *);
void tty_set_title(struct tty *, const char *);
void tty_set_path(struct tty *, const char *);
void tty_set_progress_bar(struct tty *, struct progress_bar *);
void tty_default_attributes(struct tty *, const struct grid_cell *,
struct colour_palette *, u_int, struct hyperlinks *);
void tty_default_attributes(struct tty *, u_int,
const struct tty_style_ctx *);
void tty_update_mode(struct tty *, int, struct screen *);
const struct grid_cell *tty_check_codeset(struct tty *,
const struct grid_cell *);
struct visible_ranges *tty_check_overlay_range(struct tty *, u_int, u_int,
u_int);
/* tty-draw.c */
void tty_draw_line(struct tty *, struct screen *, u_int, u_int, u_int,
u_int, u_int, const struct grid_cell *, struct colour_palette *);
void tty_sync_start(struct tty *);
void tty_sync_end(struct tty *);
int tty_open(struct tty *, char **);