refactor: add file_browser alternate select mode
This commit is contained in:
parent
bfefe2f99d
commit
43dca7e2e8
2 changed files with 14 additions and 0 deletions
|
|
@ -487,6 +487,7 @@
|
||||||
["tab", "mini_mode_try_complete_file"],
|
["tab", "mini_mode_try_complete_file"],
|
||||||
["escape", "mini_mode_cancel"],
|
["escape", "mini_mode_cancel"],
|
||||||
["enter", "mini_mode_select"],
|
["enter", "mini_mode_select"],
|
||||||
|
["shift+enter", "mini_mode_select_alternate"],
|
||||||
["backspace", "mini_mode_delete_backwards"]
|
["backspace", "mini_mode_delete_backwards"]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,11 @@ const MessageFilter = @import("../../MessageFilter.zig");
|
||||||
|
|
||||||
const max_complete_paths = 1024;
|
const max_complete_paths = 1024;
|
||||||
|
|
||||||
|
pub const SelectMode = enum {
|
||||||
|
normal,
|
||||||
|
alternate,
|
||||||
|
};
|
||||||
|
|
||||||
pub fn Create(options: type) type {
|
pub fn Create(options: type) type {
|
||||||
return struct {
|
return struct {
|
||||||
allocator: std.mem.Allocator,
|
allocator: std.mem.Allocator,
|
||||||
|
|
@ -28,6 +33,7 @@ pub fn Create(options: type) type {
|
||||||
complete_trigger_count: usize = 0,
|
complete_trigger_count: usize = 0,
|
||||||
total_matches: usize = 0,
|
total_matches: usize = 0,
|
||||||
matched_entry: usize = 0,
|
matched_entry: usize = 0,
|
||||||
|
select: SelectMode = .normal,
|
||||||
commands: Commands = undefined,
|
commands: Commands = undefined,
|
||||||
|
|
||||||
const Commands = command.Collection(cmds);
|
const Commands = command.Collection(cmds);
|
||||||
|
|
@ -372,6 +378,13 @@ pub fn Create(options: type) type {
|
||||||
}
|
}
|
||||||
pub const mini_mode_select_meta: Meta = .{ .description = "Select" };
|
pub const mini_mode_select_meta: Meta = .{ .description = "Select" };
|
||||||
|
|
||||||
|
pub fn mini_mode_select_alternate(self: *Self, _: Ctx) Result {
|
||||||
|
self.select = .alternate;
|
||||||
|
options.select(self);
|
||||||
|
self.update_mini_mode_text();
|
||||||
|
}
|
||||||
|
pub const mini_mode_select_alternate_meta: Meta = .{ .description = "Select alternate" };
|
||||||
|
|
||||||
pub fn mini_mode_paste(self: *Self, ctx: Ctx) Result {
|
pub fn mini_mode_paste(self: *Self, ctx: Ctx) Result {
|
||||||
return mini_mode_insert_bytes(self, ctx);
|
return mini_mode_insert_bytes(self, ctx);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue