feat: add repeat argument to delete_line
This commit is contained in:
parent
fc8642768d
commit
21d1555aca
1 changed files with 15 additions and 11 deletions
|
|
@ -3015,9 +3015,12 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
pub const delete_to_end_meta: Meta = .{ .description = "Delete to end of line" };
|
pub const delete_to_end_meta: Meta = .{ .description = "Delete to end of line" };
|
||||||
|
|
||||||
pub fn delete_line(self: *Self, _: Context) Result {
|
pub fn delete_line(self: *Self, ctx: Context) Result {
|
||||||
const b = try self.buf_for_update();
|
const b = try self.buf_for_update();
|
||||||
var root = b.root;
|
var root = b.root;
|
||||||
|
var repeat: usize = 1;
|
||||||
|
_ = ctx.args.match(.{tp.extract(&repeat)}) catch false;
|
||||||
|
while (repeat > 0) : (repeat -= 1) {
|
||||||
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
|
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
|
||||||
const col = cursel.cursor.col;
|
const col = cursel.cursor.col;
|
||||||
const target = cursel.cursor.target;
|
const target = cursel.cursor.target;
|
||||||
|
|
@ -3027,10 +3030,11 @@ pub const Editor = struct {
|
||||||
cursel.cursor.target = target;
|
cursel.cursor.target = target;
|
||||||
cursel.cursor.clamp_to_buffer(root, self.metrics);
|
cursel.cursor.clamp_to_buffer(root, self.metrics);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
try self.update_buf(root);
|
try self.update_buf(root);
|
||||||
self.clamp();
|
self.clamp();
|
||||||
}
|
}
|
||||||
pub const delete_line_meta: Meta = .{ .description = "Delete current line" };
|
pub const delete_line_meta: Meta = .{ .description = "Delete current line", .arguments = &.{.integer} };
|
||||||
|
|
||||||
pub fn cut_to_end_vim(self: *Self, _: Context) Result {
|
pub fn cut_to_end_vim(self: *Self, _: Context) Result {
|
||||||
const b = try self.buf_for_update();
|
const b = try self.buf_for_update();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue