goto_line_vim: integer parameters

This commit is contained in:
ivel.santos 2025-04-08 18:54:36 -03:00 committed by CJ van den Berg
parent f58babf2e7
commit 105be85d0f
3 changed files with 14 additions and 2 deletions

View file

@ -120,7 +120,7 @@
["v", "enter_mode", "select"],
["g g", "move_buffer_begin"],
["g g", "goto_line_vim"],
["g e", "move_buffer_end"],
["g f", "goto_file"],
["g h", "move_begin"],

View file

@ -51,7 +51,7 @@
["gd", "goto_definition"],
["gi", "goto_implementation"],
["gy", "goto_type_definition"],
["gg", "move_buffer_begin"],
["gg", "goto_line_vim"],
["grn", "rename_symbol"],
["gD", "goto_declaration"],
["G", "move_buffer_end"],

View file

@ -5057,6 +5057,18 @@ pub const Editor = struct {
}
pub const goto_line_meta: Meta = .{ .arguments = &.{.integer} };
pub fn goto_line_vim(self: *Self, ctx: Context) Result {
try self.send_editor_jump_source();
var line: usize = 0;
_ = ctx.args.match(.{tp.extract(&line)}) catch false;
const root = self.buf_root() catch return;
const primary = self.get_primary();
try primary.cursor.move_to(root, @intCast(if (line < 1) 0 else line - 1), primary.cursor.col, self.metrics);
self.clamp();
try self.send_editor_jump_destination();
}
pub const goto_line_vim_meta: Meta = .{ .arguments = &.{.integer} };
pub fn goto_column(self: *Self, ctx: Context) Result {
var column: usize = 0;
if (!try ctx.args.match(.{tp.extract(&column)}))