diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 6aeaf02..c078c1c 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -4626,10 +4626,7 @@ pub const Editor = struct { } pub const select_prev_sibling_meta: Meta = .{ .description = "Move selection to previous AST sibling node" }; - pub fn insert_chars(self: *Self, ctx: Context) Result { - var chars: []const u8 = undefined; - if (!try ctx.args.match(.{tp.extract(&chars)})) - return error.InvalidInsertCharsArgument; + pub fn insert_cursels(self: *Self, chars: []const u8) Result { const b = try self.buf_for_update(); var root = b.root; for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| { @@ -4638,6 +4635,13 @@ pub const Editor = struct { try self.update_buf(root); self.clamp(); } + + pub fn insert_chars(self: *Self, ctx: Context) Result { + var chars: []const u8 = undefined; + if (!try ctx.args.match(.{tp.extract(&chars)})) + return error.InvalidInsertCharsArgument; + return self.insert_cursels(chars); + } pub const insert_chars_meta: Meta = .{ .arguments = &.{.string} }; pub fn insert_line(self: *Self, _: Context) Result {