fix: move terminal native multi-cursor rendering to libvaxis
This is so that the secondary cursor escape codes are emitted under the redraw terminal sync, which avoids cursor flickering.
This commit is contained in:
parent
9c8d5f8aab
commit
9ead577e4c
2 changed files with 7 additions and 8 deletions
|
|
@ -30,8 +30,8 @@
|
|||
.hash = "fuzzig-0.1.1-Ji0xivxIAQBD0g8O_NV_0foqoPf3elsg9Sc3pNfdVH4D",
|
||||
},
|
||||
.vaxis = .{
|
||||
.url = "git+https://github.com/neurocyte/libvaxis?ref=main#164dfadbad9a5df529ade8e3f0e5c52939d27e81",
|
||||
.hash = "vaxis-0.5.1-BWNV_M4yCQBLJYI9ooJL-8dstYnId58coiBeHhF4m9wz",
|
||||
.url = "git+https://github.com/neurocyte/libvaxis?ref=main#95034c7114601178467b42e69588cdd4c1d39eb1",
|
||||
.hash = "vaxis-0.5.1-BWNV_PJJCQArtOy_n76jGWoqoBpnM5FKElA_i1IaYYcF",
|
||||
},
|
||||
.zeit = .{
|
||||
.url = "git+https://github.com/rockorager/zeit?ref=zig-0.15#ed2ca60db118414bda2b12df2039e33bad3b0b88",
|
||||
|
|
|
|||
|
|
@ -490,8 +490,7 @@ pub fn set_terminal_cursor_color(self: *Self, color: Color) void {
|
|||
}
|
||||
|
||||
pub fn set_terminal_secondary_cursor_color(self: *Self, color: Color) void {
|
||||
const rgb = RGB.from_u24(color.color);
|
||||
self.tty.writer().print("\x1b[>40;2:{d}:{d}:{d} q", .{ rgb.r, rgb.g, rgb.b }) catch {};
|
||||
self.vx.setTerminalCursorSecondaryColor(self.tty.writer(), vaxis.Cell.Color.rgbFromUint(@intCast(color.color)).rgb) catch {};
|
||||
}
|
||||
|
||||
pub fn set_terminal_working_directory(self: *Self, absolute_path: []const u8) void {
|
||||
|
|
@ -575,8 +574,8 @@ pub fn cursor_enable(self: *Self, y_: c_int, x_: c_int, shape: CursorShape) !voi
|
|||
const y: u16 = if (y_ < 0) 9999 else @intCast(y_);
|
||||
const x: u16 = if (x_ < 0) 9999 else @intCast(x_);
|
||||
self.vx.screen.cursor_vis = true;
|
||||
self.vx.screen.cursor_row = y;
|
||||
self.vx.screen.cursor_col = x;
|
||||
self.vx.screen.cursor.row = y;
|
||||
self.vx.screen.cursor.col = x;
|
||||
self.vx.screen.cursor_shape = shape;
|
||||
}
|
||||
|
||||
|
|
@ -585,11 +584,11 @@ pub fn cursor_disable(self: *Self) void {
|
|||
}
|
||||
|
||||
pub fn clear_all_multi_cursors(self: *Self) !void {
|
||||
try self.tty.writer().print("\x1b[>0;4 q", .{});
|
||||
try self.vx.resetAllTerminalSecondaryCursors(self.allocator);
|
||||
}
|
||||
|
||||
pub fn show_multi_cursor_yx(self: *Self, y: c_int, x: c_int) !void {
|
||||
try self.tty.writer().print("\x1b[>29;2:{d}:{d} q", .{ y + 1, x + 1 });
|
||||
try self.vx.addTerminalSecondaryCursor(self.allocator, @intCast(y), @intCast(x));
|
||||
}
|
||||
|
||||
fn sync_mod_state(self: *Self, keypress: u32, modifiers: vaxis.Key.Modifiers) !void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue