feat(terminal): support OSC 10/11 query terminal fg/bg color
This commit is contained in:
parent
f68102e448
commit
519d8dd886
1 changed files with 12 additions and 1 deletions
|
|
@ -189,7 +189,7 @@ pub fn shutdown(allocator: Allocator) void {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn render(self: *Self, _: *const Widget.Theme) bool {
|
||||
pub fn render(self: *Self, theme: *const Widget.Theme) bool {
|
||||
// Drain the vt event queue.
|
||||
while (self.vt.vt.tryEvent()) |event| {
|
||||
switch (event) {
|
||||
|
|
@ -209,6 +209,17 @@ pub fn render(self: *Self, _: *const Widget.Theme) bool {
|
|||
}
|
||||
}
|
||||
|
||||
// Update the terminal's fg/bg color cache from the current theme so that
|
||||
// OSC 10/11 colour queries return accurate values.
|
||||
if (theme.editor.fg) |fg| {
|
||||
const c = fg.color;
|
||||
self.vt.vt.fg_color = .{ @truncate(c >> 16), @truncate(c >> 8), @truncate(c) };
|
||||
}
|
||||
if (theme.editor.bg) |bg| {
|
||||
const c = bg.color;
|
||||
self.vt.vt.bg_color = .{ @truncate(c >> 16), @truncate(c >> 8), @truncate(c) };
|
||||
}
|
||||
|
||||
// Blit the terminal's front screen into our vaxis.Window.
|
||||
self.vt.vt.draw(self.allocator, self.plane.window, self.focused) catch |e| {
|
||||
std.log.err("terminal_view: draw failed: {}", .{e});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue