fix: merge build failure in helix.move_next_word_end and add repeat support
This commit is contained in:
		
							parent
							
								
									7a1a411aaf
								
							
						
					
					
						commit
						41339b05e4
					
				
					 2 changed files with 11 additions and 6 deletions
				
			
		| 
						 | 
					@ -2073,7 +2073,7 @@ pub const Editor = struct {
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn is_word_boundary_right_vim(root: Buffer.Root, cursor: *const Cursor, metrics: Buffer.Metrics) bool {
 | 
					    pub 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;
 | 
					        if (is_whitespace_at_cursor(root, cursor, metrics)) return false;
 | 
				
			||||||
        var next = cursor.*;
 | 
					        var next = cursor.*;
 | 
				
			||||||
        next.move_right(root, metrics) catch return true;
 | 
					        next.move_right(root, metrics) catch return true;
 | 
				
			||||||
| 
						 | 
					@ -2155,7 +2155,7 @@ pub const Editor = struct {
 | 
				
			||||||
        try cursor.move_right(root, metrics);
 | 
					        try cursor.move_right(root, metrics);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn move_cursor_right_until(root: Buffer.Root, cursor: *Cursor, pred: cursor_predicate, metrics: Buffer.Metrics) void {
 | 
					    pub fn move_cursor_right_until(root: Buffer.Root, cursor: *Cursor, pred: cursor_predicate, metrics: Buffer.Metrics) void {
 | 
				
			||||||
        while (!pred(root, cursor, metrics))
 | 
					        while (!pred(root, cursor, metrics))
 | 
				
			||||||
            move_cursor_right(root, cursor, metrics) catch return;
 | 
					            move_cursor_right(root, cursor, metrics) catch return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -126,7 +126,7 @@ const cmds_ = struct {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    pub const move_prev_word_start_meta: Meta = .{ .description = "Move previous word start", .arguments = &.{.integer} };
 | 
					    pub const move_prev_word_start_meta: Meta = .{ .description = "Move previous word start", .arguments = &.{.integer} };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pub fn move_next_word_end(_: *void, _: Ctx) Result {
 | 
					    pub fn move_next_word_end(_: *void, ctx: Ctx) Result {
 | 
				
			||||||
        const mv = tui.mainview() orelse return;
 | 
					        const mv = tui.mainview() orelse return;
 | 
				
			||||||
        const ed = mv.get_active_editor() orelse return;
 | 
					        const ed = mv.get_active_editor() orelse return;
 | 
				
			||||||
        const root = try ed.buf_root();
 | 
					        const root = try ed.buf_root();
 | 
				
			||||||
| 
						 | 
					@ -135,11 +135,10 @@ const cmds_ = struct {
 | 
				
			||||||
            cursel.disable_selection(root, ed.metrics);
 | 
					            cursel.disable_selection(root, ed.metrics);
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ed.with_selections_const(root, Editor.move_cursor_word_right_end_vim) catch {};
 | 
					        ed.with_selections_const_repeat(root, move_cursor_word_right_end_helix, ctx) catch {};
 | 
				
			||||||
        ed.with_selections_const(root, Editor.move_cursor_right) catch {};
 | 
					 | 
				
			||||||
        ed.clamp();
 | 
					        ed.clamp();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    pub const move_next_word_end_meta: Meta = .{ .description = "Move next word end" };
 | 
					    pub const move_next_word_end_meta: Meta = .{ .description = "Move next word end", .arguments = &.{.integer} };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pub fn cut_forward_internal_inclusive(_: *void, _: Ctx) Result {
 | 
					    pub fn cut_forward_internal_inclusive(_: *void, _: Ctx) Result {
 | 
				
			||||||
        const mv = tui.mainview() orelse return;
 | 
					        const mv = tui.mainview() orelse return;
 | 
				
			||||||
| 
						 | 
					@ -252,3 +251,9 @@ 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_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);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue