feat: add select_to_line_vim command
This commit is contained in:
parent
0dcf63bd38
commit
fffedb7371
1 changed files with 15 additions and 0 deletions
|
|
@ -3439,6 +3439,12 @@ pub const Editor = struct {
|
||||||
try cursor.move_to(root, line -| 1, cursor.col, metrics);
|
try cursor.move_to(root, line -| 1, cursor.col, metrics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn move_cursor_to_line_vim(root: Buffer.Root, cursor: *Cursor, ctx: Context, metrics: Buffer.Metrics) error{Stop}!void {
|
||||||
|
var line: usize = 0;
|
||||||
|
_ = ctx.args.match(.{tp.extract(&line)}) catch false;
|
||||||
|
try cursor.move_to(root, line -| 1, cursor.col, metrics);
|
||||||
|
}
|
||||||
|
|
||||||
fn move_cursor_to_char_left(root: Buffer.Root, cursor: *Cursor, ctx: Context, metrics: Buffer.Metrics) error{Stop}!void {
|
fn move_cursor_to_char_left(root: Buffer.Root, cursor: *Cursor, ctx: Context, metrics: Buffer.Metrics) error{Stop}!void {
|
||||||
var egc: []const u8 = undefined;
|
var egc: []const u8 = undefined;
|
||||||
if (!(ctx.args.match(.{tp.extract(&egc)}) catch return error.Stop))
|
if (!(ctx.args.match(.{tp.extract(&egc)}) catch return error.Stop))
|
||||||
|
|
@ -5768,6 +5774,15 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
pub const goto_line_vim_meta: Meta = .{ .arguments = &.{.integer} };
|
pub const goto_line_vim_meta: Meta = .{ .arguments = &.{.integer} };
|
||||||
|
|
||||||
|
pub fn select_to_line_vim(self: *Self, ctx: Context) Result {
|
||||||
|
try self.send_editor_jump_source();
|
||||||
|
const root = self.buf_root() catch return;
|
||||||
|
self.with_selections_const_arg(root, move_cursor_to_line_vim, ctx) catch {};
|
||||||
|
self.clamp();
|
||||||
|
try self.send_editor_jump_destination();
|
||||||
|
}
|
||||||
|
pub const select_to_line_vim_meta: Meta = .{ .arguments = &.{.integer} };
|
||||||
|
|
||||||
pub fn goto_column(self: *Self, ctx: Context) Result {
|
pub fn goto_column(self: *Self, ctx: Context) Result {
|
||||||
const root = self.buf_root() catch return;
|
const root = self.buf_root() catch return;
|
||||||
const primary = self.get_primary();
|
const primary = self.get_primary();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue