Compare commits
2 commits
c04bbe4062
...
5438f19015
| Author | SHA1 | Date | |
|---|---|---|---|
| 5438f19015 | |||
| 03c6e4def0 |
5 changed files with 29 additions and 3 deletions
|
|
@ -45,6 +45,7 @@ indent_mode: IndentMode = .auto,
|
|||
|
||||
top_bar: []const u8 = "tabs",
|
||||
bottom_bar: []const u8 = "mode file log selection diagnostics keybind branch linenumber clock spacer",
|
||||
show_bottom_bar_grip: bool = true,
|
||||
show_scrollbars: bool = true,
|
||||
show_fileicons: bool = true,
|
||||
show_local_diagnostics_in_panel: bool = false,
|
||||
|
|
|
|||
|
|
@ -513,7 +513,6 @@
|
|||
["alt+v", "system_paste"],
|
||||
["alt+n", "goto_next_file"],
|
||||
["alt+p", "goto_prev_file"],
|
||||
["shift+enter", "goto_prev_match"],
|
||||
["shift+f3", "goto_prev_match"],
|
||||
["up", "select_prev_file"],
|
||||
["down", "select_next_file"],
|
||||
|
|
@ -523,6 +522,7 @@
|
|||
["f10", "theme_next"],
|
||||
["escape", "mini_mode_cancel"],
|
||||
["enter", "mini_mode_select"],
|
||||
["shift+enter", "mini_mode_select_alternate"],
|
||||
["backspace", "mini_mode_delete_backwards"]
|
||||
]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ view_rows: usize = 0,
|
|||
view_cols: usize = 0,
|
||||
entries: std.ArrayList(Entry) = undefined,
|
||||
selected: ?usize = null,
|
||||
activate: ActivateMode = .normal,
|
||||
box: Widget.Box = .{},
|
||||
|
||||
const MenuType = Menu.Options(*Self).MenuType;
|
||||
|
|
@ -40,6 +41,11 @@ const ButtonType = MenuType.ButtonType;
|
|||
const path_column_ratio = 4;
|
||||
const widget_type: Widget.Type = .panel;
|
||||
|
||||
pub const ActivateMode = enum {
|
||||
normal,
|
||||
alternate,
|
||||
};
|
||||
|
||||
const Entry = struct {
|
||||
path: []const u8,
|
||||
begin_line: usize,
|
||||
|
|
@ -243,7 +249,12 @@ fn handle_menu_action(menu: **MenuType, button: *ButtonType, _: Widget.Pos) void
|
|||
self.update_selected();
|
||||
const entry = &self.entries.items[idx];
|
||||
|
||||
tp.self_pid().send(.{ "cmd", "navigate", .{
|
||||
const cmd_ = switch (menu.*.opts.ctx.activate) {
|
||||
.normal => "navigate",
|
||||
.alternate => "navigate_split_vertical",
|
||||
};
|
||||
|
||||
tp.self_pid().send(.{ "cmd", cmd_, .{
|
||||
.file = entry.path,
|
||||
.goto = .{
|
||||
entry.end_line + 1,
|
||||
|
|
@ -303,4 +314,11 @@ const cmds = struct {
|
|||
self.menu.activate_selected();
|
||||
}
|
||||
pub const goto_selected_file_meta: Meta = .{};
|
||||
|
||||
pub fn goto_selected_file_alternate(self: *Self, _: Ctx) Result {
|
||||
if (self.menu.selected == null) return tp.exit_error(error.NoSelectedFile, @errorReturnTrace());
|
||||
self.activate = .alternate;
|
||||
self.menu.activate_selected();
|
||||
}
|
||||
pub const goto_selected_file_alternate_meta: Meta = .{};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -110,7 +110,8 @@ pub fn create(allocator: std.mem.Allocator) CreateError!Widget {
|
|||
try widgets.add(self.panes_widget);
|
||||
|
||||
if (tui.config().bottom_bar.len > 0) {
|
||||
self.bottom_bar = (try widgets.addP(try @import("status/bar.zig").create(allocator, self.plane, tui.config().bottom_bar, .grip, EventHandler.bind(self, handle_bottom_bar_event)))).*;
|
||||
const bar_style: @import("status/bar.zig").Style = if (tui.config().show_bottom_bar_grip) .grip else .none;
|
||||
self.bottom_bar = (try widgets.addP(try @import("status/bar.zig").create(allocator, self.plane, tui.config().bottom_bar, bar_style, EventHandler.bind(self, handle_bottom_bar_event)))).*;
|
||||
}
|
||||
if (tp.env.get().is("show-input")) {
|
||||
self.toggle_inputview_async();
|
||||
|
|
|
|||
|
|
@ -112,6 +112,12 @@ const cmds = struct {
|
|||
}
|
||||
pub const mini_mode_select_meta: Meta = .{ .description = "Select" };
|
||||
|
||||
pub fn mini_mode_select_alternate(_: *Self, _: Ctx) Result {
|
||||
command.executeName("goto_selected_file_alternate", .{}) catch {};
|
||||
return command.executeName("exit_mini_mode", .{});
|
||||
}
|
||||
pub const mini_mode_select_alternate_meta: Meta = .{ .description = "Select alternate" };
|
||||
|
||||
pub fn mini_mode_insert_code_point(self: *Self, ctx: Ctx) Result {
|
||||
var egc: u32 = 0;
|
||||
if (!try ctx.args.match(.{tp.extract(&egc)}))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue