Compare commits

..

No commits in common. "41339b05e4fecd9fe38a737706b1a21eac6d6f1f" and "ae815043d9f915a887a9b4c873aad44b3c943ee8" have entirely different histories.

2 changed files with 4 additions and 23 deletions

View file

@ -129,7 +129,7 @@ pub const CurSel = struct {
return res;
}
pub fn disable_selection(self: *Self, root: Buffer.Root, metrics: Buffer.Metrics) void {
fn disable_selection(self: *Self, root: Buffer.Root, metrics: Buffer.Metrics) void {
switch (tui.get_selection_style()) {
.normal => self.disable_selection_normal(),
.inclusive => self.disable_selection_inclusive(root, metrics),
@ -2073,7 +2073,7 @@ pub const Editor = struct {
return false;
}
pub fn is_word_boundary_right_vim(root: Buffer.Root, cursor: *const Cursor, metrics: Buffer.Metrics) bool {
fn is_word_boundary_right_vim(root: Buffer.Root, cursor: *const Cursor, metrics: Buffer.Metrics) bool {
if (is_whitespace_at_cursor(root, cursor, metrics)) return false;
var next = cursor.*;
next.move_right(root, metrics) catch return true;
@ -2155,7 +2155,7 @@ pub const Editor = struct {
try cursor.move_right(root, metrics);
}
pub fn move_cursor_right_until(root: Buffer.Root, cursor: *Cursor, pred: cursor_predicate, metrics: Buffer.Metrics) void {
fn move_cursor_right_until(root: Buffer.Root, cursor: *Cursor, pred: cursor_predicate, metrics: Buffer.Metrics) void {
while (!pred(root, cursor, metrics))
move_cursor_right(root, cursor, metrics) catch return;
}

View file

@ -110,6 +110,7 @@ const cmds_ = struct {
ed.with_selections_const_repeat(root, Editor.move_cursor_word_right_vim, ctx) catch {};
ed.clamp();
}
pub const move_next_word_start_meta: Meta = .{ .description = "Move next word start", .arguments = &.{.integer} };
pub fn move_prev_word_start(_: *void, ctx: Ctx) Result {
@ -126,20 +127,6 @@ const cmds_ = struct {
}
pub const move_prev_word_start_meta: Meta = .{ .description = "Move previous word start", .arguments = &.{.integer} };
pub fn move_next_word_end(_: *void, ctx: Ctx) Result {
const mv = tui.mainview() orelse return;
const ed = mv.get_active_editor() orelse return;
const root = try ed.buf_root();
for (ed.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
cursel.disable_selection(root, ed.metrics);
};
ed.with_selections_const_repeat(root, move_cursor_word_right_end_helix, ctx) catch {};
ed.clamp();
}
pub const move_next_word_end_meta: Meta = .{ .description = "Move next word end", .arguments = &.{.integer} };
pub fn cut_forward_internal_inclusive(_: *void, _: Ctx) Result {
const mv = tui.mainview() orelse return;
const ed = mv.get_active_editor() orelse return;
@ -251,9 +238,3 @@ fn move_cursor_word_left_helix(root: Buffer.Root, cursor: *Cursor, metrics: Buff
}
fn move_noop(_: Buffer.Root, _: *Cursor, _: Buffer.Metrics) error{Stop}!void {}
fn move_cursor_word_right_end_helix(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) error{Stop}!void {
try Editor.move_cursor_right(root, cursor, metrics);
Editor.move_cursor_right_until(root, cursor, Editor.is_word_boundary_right_vim, metrics);
try cursor.move_right(root, metrics);
}