fix: don't disable primary terminal cursor when offscreen
Disabling the primary cursor when offscreen will also disable secondary cursors when kitty's multi-cursor support is enabled. So instead we move the primary cursor offscreen.
This commit is contained in:
parent
7b1f6c898d
commit
1b9e01671a
2 changed files with 16 additions and 14 deletions
|
|
@ -561,10 +561,12 @@ 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, shape: CursorShape) !void {
|
||||
pub fn cursor_enable(self: *Self, y_: c_int, x_: c_int, shape: CursorShape) !void {
|
||||
const y: u16 = if (y_ < 0) self.vx.screen.height + 1 else @intCast(y_);
|
||||
const x: u16 = if (x_ < 0) self.vx.screen.width + 1 else @intCast(x_);
|
||||
self.vx.screen.cursor_vis = true;
|
||||
self.vx.screen.cursor_row = @intCast(y);
|
||||
self.vx.screen.cursor_col = @intCast(x);
|
||||
self.vx.screen.cursor_row = y;
|
||||
self.vx.screen.cursor_col = x;
|
||||
self.vx.screen.cursor_shape = shape;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1283,22 +1283,22 @@ pub const Editor = struct {
|
|||
self.render_cursor_cell(style);
|
||||
}
|
||||
} else {
|
||||
const configured_shape = tui.get_cursor_shape();
|
||||
const cursor_shape = if (tui.rdr().vx.caps.multi_cursor)
|
||||
configured_shape
|
||||
else if (self.cursels.items.len > 1) switch (configured_shape) {
|
||||
.beam => .block,
|
||||
.beam_blink => .block_blink,
|
||||
.underline => .block,
|
||||
.underline_blink => .block_blink,
|
||||
else => configured_shape,
|
||||
} else configured_shape;
|
||||
if (self.screen_cursor(cursor)) |pos| {
|
||||
set_cell_map_cursor(cell_map, pos.row, pos.col);
|
||||
const y, const x = self.plane.rel_yx_to_abs(@intCast(pos.row), @intCast(pos.col));
|
||||
const configured_shape = tui.get_cursor_shape();
|
||||
const cursor_shape = if (tui.rdr().vx.caps.multi_cursor)
|
||||
configured_shape
|
||||
else if (self.cursels.items.len > 1) switch (configured_shape) {
|
||||
.beam => .block,
|
||||
.beam_blink => .block_blink,
|
||||
.underline => .block,
|
||||
.underline_blink => .block_blink,
|
||||
else => configured_shape,
|
||||
} else configured_shape;
|
||||
tui.rdr().cursor_enable(y, x, cursor_shape) catch {};
|
||||
} else {
|
||||
tui.rdr().cursor_disable();
|
||||
tui.rdr().cursor_enable(-1, -1, cursor_shape) catch {};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue