vim: change cursor shape when only one cursor

In vim mode, change the cursor shape depending on the mode. This is only
applicable if `enable_terminal_cursor` is set to true and there is only
one cursor in the editor.
This commit is contained in:
Tim Culverhouse 2024-08-26 07:02:46 -05:00 committed by CJ van den Berg
parent b115d55097
commit d4b7a6ab9b
6 changed files with 14 additions and 2 deletions

View file

@ -9,6 +9,7 @@ pub const input = @import("input.zig");
pub const Plane = @import("Plane.zig");
pub const Cell = @import("Cell.zig");
pub const CursorShape = vaxis.Cell.CursorShape;
pub const style = @import("style.zig").StyleBits;
@ -355,10 +356,11 @@ pub fn request_mouse_cursor_default(self: *Self, push_or_pop: bool) void {
if (push_or_pop) self.vx.setMouseShape(.default) else self.vx.setMouseShape(.default);
}
pub fn cursor_enable(self: *Self, y: c_int, x: c_int) !void {
pub fn cursor_enable(self: *Self, y: c_int, x: c_int, shape: CursorShape) !void {
self.vx.screen.cursor_vis = true;
self.vx.screen.cursor_row = @intCast(y);
self.vx.screen.cursor_col = @intCast(x);
self.vx.screen.cursor_shape = shape;
}
pub fn cursor_disable(self: *Self) void {