feat: use terminal cursors for mini mode and overlay input boxes

closes: #80
This commit is contained in:
CJ van den Berg 2024-12-17 19:15:20 +01:00
parent ff0987c108
commit 32d67a3972
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
4 changed files with 35 additions and 14 deletions

View file

@ -843,15 +843,18 @@ pub const Editor = struct {
}
fn render_terminal_cursor(self: *const Self, cursor_: *const Cursor) !void {
const tui_ = tui.current();
if (tui_.is_mini_or_overlay_enabled())
return;
if (self.screen_cursor(cursor_)) |cursor| {
const y, const x = self.plane.rel_yx_to_abs(@intCast(cursor.row), @intCast(cursor.col));
const shape = if (tui.current().input_mode) |mode|
const shape = if (tui_.input_mode) |mode|
mode.cursor_shape
else
.block;
tui.current().rdr.cursor_enable(y, x, tui.translate_cursor_shape(shape)) catch {};
tui_.rdr.cursor_enable(y, x, tui.translate_cursor_shape(shape)) catch {};
} else {
tui.current().rdr.cursor_disable();
tui_.rdr.cursor_disable();
}
}