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.
This commit is contained in:
CJ van den Berg 2024-12-20 21:12:23 +01:00
parent 2357c44912
commit deaafbefa0
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -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();
}