From deaafbefa022fd1c5d75c07c09b5995bbd07910d Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Fri, 20 Dec 2024 21:12:23 +0100 Subject: [PATCH] feat: upgrade cursors to block cursors when multi-cursor editing This is to match the secondary cursors which are always block cursors. It also give some visual feedback that we are multi-cursor. --- src/tui/editor.zig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index cbc5c6e..bbc56f4 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -877,7 +877,15 @@ 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)); - tui_.rdr.cursor_enable(y, x, tui_.get_cursor_shape()) catch {}; + const configured_shape = tui_.get_cursor_shape(); + const cursor_shape = 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(); }