feat: add basic POC support for kitty multi cursor protocol

This commit is contained in:
CJ van den Berg 2025-08-25 21:02:53 +02:00
parent 8454ebc9f4
commit 5caab36297
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 27 additions and 5 deletions

View file

@ -382,6 +382,11 @@ pub fn process_renderer_event(self: *Self, msg: []const u8) Error!void {
self.vx.caps.rgb = true;
},
.cap_color_scheme_updates => {},
.cap_multi_cursor => {
self.logger.print("multi cursor capability detected", .{});
self.vx.caps.multi_cursor = true;
},
}
}
@ -535,6 +540,14 @@ pub fn cursor_disable(self: *Self) void {
self.vx.screen.cursor_vis = false;
}
pub fn clear_all_multi_cursors(self: *Self) !void {
try self.tty.anyWriter().print("\x1b[>0;4 q", .{});
}
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 });
}
fn sync_mod_state(self: *Self, keypress: u32, modifiers: vaxis.Key.Modifiers) !void {
if (modifiers.ctrl and !self.mods.ctrl and !(keypress == input.key.left_control or keypress == input.key.right_control))
try self.send_sync_key(input.event.press, input.key.left_control, "", modifiers);