refactor: eliminate redundent healper function
This commit is contained in:
parent
faa54afb8b
commit
eba444c6fc
1 changed files with 6 additions and 8 deletions
|
|
@ -313,12 +313,16 @@ const cmds_ = struct {
|
|||
pub const extend_next_long_word_start_meta: Meta = .{ .description = "Extend next long word start", .arguments = &.{.integer} };
|
||||
|
||||
pub fn move_prev_word_start(self: *Self, ctx: Context) Result {
|
||||
try move_cursels_const_repeat(self, move_cursor_prev_word_start, ctx);
|
||||
const root = try self.buf_root();
|
||||
try self.with_cursels_const_repeat(root, move_cursor_prev_word_start, ctx);
|
||||
self.clamp();
|
||||
}
|
||||
pub const move_prev_word_start_meta: Meta = .{ .description = "Move previous word start", .arguments = &.{.integer} };
|
||||
|
||||
pub fn extend_prev_word_start(self: *Self, ctx: Context) Result {
|
||||
try move_cursels_const_repeat(self, move_cursor_prev_word_start_extend, ctx);
|
||||
const root = try self.buf_root();
|
||||
try self.with_cursels_const_repeat(root, move_cursor_prev_word_start_extend, ctx);
|
||||
self.clamp();
|
||||
}
|
||||
pub const extend_prev_word_start_meta: Meta = .{ .description = "Extend previous word start", .arguments = &.{.integer} };
|
||||
|
||||
|
|
@ -602,12 +606,6 @@ fn move_cursor_prev_word_start_extend(root: Buffer.Root, cursel: *CurSel, metric
|
|||
try move_cursor_prev_word_start(root, cursel, metrics);
|
||||
}
|
||||
|
||||
fn move_cursels_const_repeat(self: *Self, move: Editor.cursel_operator_const, ctx: Context) Result {
|
||||
const root = try self.buf_root();
|
||||
try self.with_cursels_const_repeat(root, move, ctx);
|
||||
self.clamp();
|
||||
}
|
||||
|
||||
fn match_bracket(root: Buffer.Root, cursel: *CurSel, ctx: command.Context, metrics: Buffer.Metrics) error{Stop}!void {
|
||||
var symbol: []const u8 = undefined;
|
||||
const mode: enum { helix_sel_mode, helix_nor_mode } = if ((ctx.args.match(.{tp.extract(&symbol)}) catch false) and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue