Compare commits

...

2 commits

3 changed files with 15 additions and 1 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 {};
}
@ -545,7 +551,7 @@ pub fn clear_all_multi_cursors(self: *Self) !void {
}
pub fn show_multi_cursor_yx(self: *Self, y: c_int, x: c_int) !void {
try self.tty.anyWriter().print("\x1b[>-1;2:{d}:{d} q", .{ y + 1, x + 1 });
try self.tty.anyWriter().print("\x1b[>29;2:{d}:{d} q", .{ y + 1, x + 1 });
}
fn sync_mod_state(self: *Self, keypress: u32, modifiers: vaxis.Key.Modifiers) !void {

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.?);
}
}