feat: implement helix keep_primary_selection
This commit is contained in:
parent
090d27d890
commit
791b184583
2 changed files with 12 additions and 2 deletions
|
|
@ -1901,7 +1901,7 @@ pub const Editor = struct {
|
|||
};
|
||||
}
|
||||
|
||||
fn cancel_all_selections(self: *Self) void {
|
||||
pub fn cancel_all_selections(self: *Self) void {
|
||||
var primary = self.get_primary().*;
|
||||
primary.disable_selection(self.buf_root() catch return, self.metrics);
|
||||
self.cursels.clearRetainingCapacity();
|
||||
|
|
@ -1911,7 +1911,7 @@ pub const Editor = struct {
|
|||
};
|
||||
}
|
||||
|
||||
fn cancel_all_matches(self: *Self) void {
|
||||
pub fn cancel_all_matches(self: *Self) void {
|
||||
self.matches.clearAndFree(self.allocator);
|
||||
self.match_type = .none;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -488,6 +488,16 @@ const cmds_ = struct {
|
|||
ed.need_render();
|
||||
}
|
||||
pub const replace_with_character_helix_meta: Meta = .{ .description = "Replace with character" };
|
||||
|
||||
pub fn keep_primary_selection(_: *void, _: Ctx) Result {
|
||||
const mv = tui.mainview() orelse return;
|
||||
const ed = mv.get_active_editor() orelse return;
|
||||
const primary = ed.get_primary().*;
|
||||
ed.cancel_all_selections();
|
||||
ed.cancel_all_matches();
|
||||
ed.get_primary().* = primary;
|
||||
}
|
||||
pub const keep_primary_selection_meta: Meta = .{};
|
||||
};
|
||||
|
||||
fn match_bracket(root: Buffer.Root, cursel: *CurSel, ctx: command.Context, metrics: Buffer.Metrics) error{Stop}!void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue