termio: report color scheme synchronously

The reporting of color scheme was handled asynchronously by queuing a
handler in the surface. This could lead to race conditions where the
DSR is reported after subsequent VT sequences.

Fixes #5922
This commit is contained in:
Tobias Kohlbau
2025-11-25 22:19:57 +01:00
parent 250877eff6
commit 836d794b9e
6 changed files with 32 additions and 31 deletions

View File

@@ -119,7 +119,7 @@ pub const StreamHandler = struct {
};
// The config could have changed any of our colors so update mode 2031
self.surfaceMessageWriter(.{ .report_color_scheme = false });
self.messageWriter(.{ .color_scheme_report = .{ .force = false } });
}
inline fn surfaceMessageWriter(
@@ -871,7 +871,7 @@ pub const StreamHandler = struct {
self.messageWriter(msg);
},
.color_scheme => self.surfaceMessageWriter(.{ .report_color_scheme = true }),
.color_scheme => self.messageWriter(.{ .color_scheme_report = .{ .force = true } }),
}
}
@@ -956,7 +956,7 @@ pub const StreamHandler = struct {
try self.setMouseShape(.text);
// Reset resets our palette so we report it for mode 2031.
self.surfaceMessageWriter(.{ .report_color_scheme = false });
self.messageWriter(.{ .color_scheme_report = .{ .force = false } });
// Clear the progress bar
self.progressReport(.{ .state = .remove });