aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-07-03 07:59:56 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-07-03 07:59:56 +0000
commite5ed387426cb7d50d6d24dc0a3fbf95334314d40 (patch)
tree075e84e1f06a7120f1abb1292ba144b81cac894d /terminal.c
parentcsi: implement SGR 21, double underlines (diff)
parentcsi: redraw margins after restoring the palette (diff)
Merge branch 'color-stack'
Closes #856
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/terminal.c b/terminal.c
index 0518e57d..ca3d2bc1 100644
--- a/terminal.c
+++ b/terminal.c
@@ -1221,10 +1221,17 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
.fg = conf->colors.fg,
.bg = conf->colors.bg,
.alpha = conf->colors.alpha,
+ .cursor_fg = conf->cursor.color.text,
+ .cursor_bg = conf->cursor.color.cursor,
.selection_fg = conf->colors.selection_fg,
.selection_bg = conf->colors.selection_bg,
.use_custom_selection = conf->colors.use_custom.selection,
},
+ .color_stack = {
+ .stack = NULL,
+ .size = 0,
+ .idx = 0,
+ },
.origin = ORIGIN_ABSOLUTE,
.cursor_style = conf->cursor.style,
.cursor_blink = {
@@ -1233,10 +1240,6 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
.state = CURSOR_BLINK_ON,
.fd = -1,
},
- .cursor_color = {
- .text = conf->cursor.color.text,
- .cursor = conf->cursor.color.cursor,
- },
.selection = {
.coords = {
.start = {-1, -1},
@@ -1825,6 +1828,7 @@ term_destroy(struct terminal *term)
free(term->foot_exe);
free(term->cwd);
free(term->mouse_user_cursor);
+ free(term->color_stack.stack);
int ret = EXIT_SUCCESS;
@@ -2035,11 +2039,17 @@ term_reset(struct terminal *term, bool hard)
term->colors.fg = term->conf->colors.fg;
term->colors.bg = term->conf->colors.bg;
term->colors.alpha = term->conf->colors.alpha;
+ term->colors.cursor_fg = term->conf->cursor.color.text;
+ term->colors.cursor_bg = term->conf->cursor.color.cursor;
term->colors.selection_fg = term->conf->colors.selection_fg;
term->colors.selection_bg = term->conf->colors.selection_bg;
term->colors.use_custom_selection = term->conf->colors.use_custom.selection;
memcpy(term->colors.table, term->conf->colors.table,
sizeof(term->colors.table));
+ free(term->color_stack.stack);
+ term->color_stack.stack = NULL;
+ term->color_stack.size = 0;
+ term->color_stack.idx = 0;
term->origin = ORIGIN_ABSOLUTE;
term->normal.cursor.lcf = false;
term->alt.cursor.lcf = false;
@@ -2051,8 +2061,6 @@ term_reset(struct terminal *term, bool hard)
term->cursor_blink.decset = false;
term->cursor_blink.deccsusr = term->conf->cursor.blink.enabled;
term_cursor_blink_update(term);
- term->cursor_color.text = term->conf->cursor.color.text;
- term->cursor_color.cursor = term->conf->cursor.color.cursor;
selection_cancel(term);
term->normal.offset = term->normal.view = 0;
term->alt.offset = term->alt.view = 0;