feat: set secondary cursors color from theme in multi cursor mode

This commit is contained in:
CJ van den Berg 2025-09-08 22:07:10 +02:00
parent 44e19d2193
commit 251c74a23b
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 14 additions and 0 deletions

View file

@ -6,6 +6,7 @@ const Color = @import("theme").Color;
const vaxis = @import("vaxis");
const input = @import("input");
const builtin = @import("builtin");
const RGB = @import("color").RGB;
pub const Plane = @import("Plane.zig");
pub const Cell = @import("Cell.zig");
@ -456,6 +457,11 @@ pub fn set_terminal_cursor_color(self: *Self, color: Color) void {
self.vx.setTerminalCursorColor(self.tty.anyWriter(), vaxis.Cell.Color.rgbFromUint(@intCast(color.color)).rgb) catch {};
}
pub fn set_terminal_secondary_cursor_color(self: *Self, color: Color) void {
const rgb = RGB.from_u24(color.color);
self.tty.anyWriter().print("\x1b[>40;2:{d}:{d}:{d} q", .{ rgb.r, rgb.g, rgb.b }) catch {};
}
pub fn set_terminal_working_directory(self: *Self, absolute_path: []const u8) void {
self.vx.setTerminalWorkingDirectory(self.tty.anyWriter(), absolute_path) catch {};
}

View file

@ -440,6 +440,12 @@ pub fn set_terminal_cursor_color(self: *Self, color: Color) void {
//@panic("todo");
}
pub fn set_terminal_secondary_cursor_color(self: *Self, color: Color) void {
_ = self;
_ = color;
//@panic("todo");
}
pub fn set_terminal_working_directory(self: *Self, absolute_path: []const u8) void {
_ = self;
_ = absolute_path;

View file

@ -1448,6 +1448,8 @@ fn set_terminal_style(self: *Self) void {
if (build_options.gui or self.config_.enable_terminal_color_scheme) {
self.rdr_.set_terminal_style(self.theme_.editor);
self.rdr_.set_terminal_cursor_color(self.theme_.editor_cursor.bg.?);
if (self.rdr_.vx.caps.multi_cursor)
self.rdr_.set_terminal_secondary_cursor_color(self.theme_.editor_cursor_secondary.bg orelse self.theme_.editor_cursor.bg.?);
}
}