} else if (c == ']') {
f->ansi_color_state = ANSI_COLOR_STATE_OSC_SEQUENCE;
continue;
+ } else if (c == 'c') {
+ /* "Full reset" aka "Reset to initial state"*/
+ r = insert_background_color(f, i+1);
+ if (r < 0)
+ return r;
+
+ i += r;
+
+ f->ansi_color_state = ANSI_COLOR_STATE_TEXT;
+ continue;
}
break;
} else {
/* Otherwise, the CSI sequence is over */
- if (c == 'm') {
+ if (c == 'p' && streq_ptr(f->csi_sequence, "!")) {
+
+ /* CSI ! p → "Soft Reset", let's immediately fix our bg color again */
+ r = insert_background_color(f, i+1);
+ if (r < 0)
+ return r;
+
+ i += r;
+ } else if (c == 'm') {
/* This is an "SGR" (Select Graphic Rendition) sequence. Patch in our background color. */
r = insert_background_fix(f, i);
if (r < 0)