aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraloires <aloires@tutamail.com>2026-08-14 21:04:00 +0000
committerDaniel Eklöf <daniel@ekloef.se>2026-08-15 05:20:50 +0000
commit4eaae1cb826f5338e992579991f41fd71f99fb92 (patch)
tree99b030b7f533922eec59056e6a67d7ffd79de4b8
parentchangelog: window urgency on notification activation without XDG token (diff)
terminal: keep saved SGR attributes per-grid
DECSC/DECRC (ESC7/ESC8), CSI s/u and DECSET/DECRST 1048/1049 all save/restore the SGR attributes through the same, global saved_attrs slot. An application emitting ESC7/ESC8 in the alternate screen to wrap sixel rendering in a save/restore-cursor pair overwrites the slot with its own SGR state. DECRST 1049 then restores those attributes, instead of the ones saved by DECSET 1049. The shell prompt is left with the application's attributes, even though the application reset them (sgr0) before exiting.
-rw-r--r--terminal.c4
-rw-r--r--terminal.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/terminal.c b/terminal.c
index 3fa813a5..868861d2 100644
--- a/terminal.c
+++ b/terminal.c
@@ -3273,7 +3273,7 @@ void
term_save_cursor(struct terminal *term)
{
term->grid->saved_cursor = term->grid->cursor;
- term->vt.saved_attrs = term->vt.attrs;
+ term->grid->saved_attrs = term->vt.attrs;
term->saved_charsets = term->charsets;
}
@@ -3286,7 +3286,7 @@ term_restore_cursor(struct terminal *term, const struct cursor *cursor)
term_cursor_to(term, row, col);
term->grid->cursor.lcf = cursor->lcf;
- term->vt.attrs = term->vt.saved_attrs;
+ term->vt.attrs = term->grid->saved_attrs;
term->charsets = term->saved_charsets;
term->bits_affecting_ascii_printer.charset =
diff --git a/terminal.h b/terminal.h
index 3e2c6904..0cac1e3b 100644
--- a/terminal.h
+++ b/terminal.h
@@ -233,6 +233,7 @@ struct grid {
*/
struct cursor cursor;
struct cursor saved_cursor;
+ struct attributes saved_attrs;
struct row **rows;
struct row *cur_row;
@@ -277,7 +278,6 @@ struct vt {
uint32_t private; /* LSB=priv0, MSB=priv3 */
struct attributes attrs;
- struct attributes saved_attrs;
struct {
uint8_t *data;