diff --git a/src/tui/InputBox.zig b/src/tui/InputBox.zig index 20bf405..10f41e5 100644 --- a/src/tui/InputBox.zig +++ b/src/tui/InputBox.zig @@ -39,7 +39,7 @@ pub fn Options(context: type) type { const tui_ = tui.current(); if (tui_.config.enable_terminal_cursor) { const y, const x = self.plane.rel_yx_to_abs(0, pos + 1); - tui_.rdr.cursor_enable(y, x, .default) catch {}; + tui_.rdr.cursor_enable(y, x, tui_.get_cursor_shape()) catch {}; } else { self.plane.cursor_move_yx(0, pos + 1) catch return false; var cell = self.plane.cell_init(); diff --git a/src/tui/editor.zig b/src/tui/editor.zig index b8453cb..b140f53 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -877,11 +877,7 @@ pub const Editor = struct { } else { if (self.screen_cursor(cursor)) |pos| { const y, const x = self.plane.rel_yx_to_abs(@intCast(pos.row), @intCast(pos.col)); - const shape = if (tui_.input_mode) |mode| - mode.cursor_shape - else - .block; - tui_.rdr.cursor_enable(y, x, tui.translate_cursor_shape(shape)) catch {}; + tui_.rdr.cursor_enable(y, x, tui_.get_cursor_shape()) catch {}; } else { tui_.rdr.cursor_disable(); } diff --git a/src/tui/status/filestate.zig b/src/tui/status/filestate.zig index 91e4351..008f6ae 100644 --- a/src/tui/status/filestate.zig +++ b/src/tui/status/filestate.zig @@ -109,7 +109,7 @@ fn render_mini_mode(plane: *Plane, theme: *const Widget.Theme) void { const pos: c_int = @intCast(cursor); if (tui_.config.enable_terminal_cursor) { const y, const x = plane.rel_yx_to_abs(0, pos + 1); - tui_.rdr.cursor_enable(y, x, .default) catch {}; + tui_.rdr.cursor_enable(y, x, tui_.get_cursor_shape()) catch {}; } else { plane.cursor_move_yx(0, pos + 1) catch return; var cell = plane.cell_init(); diff --git a/src/tui/tui.zig b/src/tui/tui.zig index 8d79ad4..63e8e28 100644 --- a/src/tui/tui.zig +++ b/src/tui/tui.zig @@ -1096,8 +1096,9 @@ fn set_terminal_style(self: *Self) void { } } -pub fn translate_cursor_shape(in: keybind.CursorShape) renderer.CursorShape { - return switch (in) { +pub fn get_cursor_shape(self: *Self) renderer.CursorShape { + const shape = if (self.input_mode) |mode| mode.cursor_shape else .block; + return switch (shape) { .default => .default, .block_blink => .block_blink, .block => .block,