refactor: clean-up and simplify home screen keys
This commit is contained in:
parent
9537c54962
commit
1d418db9b4
2 changed files with 19 additions and 6 deletions
|
@ -89,12 +89,13 @@ pub fn render(self: *Self, theme: *const Widget.Theme) bool {
|
||||||
|
|
||||||
fn render_hints(self: *Self, style_base: Widget.Theme.Style, style_text: Widget.Theme.Style, style_keybind: Widget.Theme.Style) void {
|
fn render_hints(self: *Self, style_base: Widget.Theme.Style, style_text: Widget.Theme.Style, style_keybind: Widget.Theme.Style) void {
|
||||||
const hint_text: [:0]const u8 =
|
const hint_text: [:0]const u8 =
|
||||||
\\Help ······················· :F1 / C-?
|
\\Help ······················· :h
|
||||||
\\Open file ·················· :C-o
|
\\Open file ·················· :o
|
||||||
\\Open recent file ··(wip)···· :C-e / C-r
|
\\Open recent file ··(wip)···· :e
|
||||||
\\Show/Run commands ·(wip)···· :C-p / C-S-p
|
\\Open recent project ··(wip)· :r
|
||||||
\\Open config file ··········· :F6
|
\\Show/Run commands ·(wip)···· :p
|
||||||
\\Quit/Close ················· :C-q, C-w
|
\\Open config file ··········· :c
|
||||||
|
\\Quit/Close ················· :q
|
||||||
\\
|
\\
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,14 @@ fn mapPress(self: *Self, keypress: u32, modifiers: u32) tp.result {
|
||||||
else => {},
|
else => {},
|
||||||
},
|
},
|
||||||
0 => switch (keypress) {
|
0 => switch (keypress) {
|
||||||
|
'h' => self.cmd("open_help", .{}),
|
||||||
|
'o' => self.cmd("enter_open_file_mode", .{}),
|
||||||
|
'e' => self.msg("open recent file not implemented"),
|
||||||
|
'r' => self.msg("open recent project not implemented"),
|
||||||
|
'p' => self.msg("open command palette not implemented"),
|
||||||
|
'c' => self.cmd("open_config", .{}),
|
||||||
|
'q' => self.cmd("quit", .{}),
|
||||||
|
|
||||||
nc.key.F01 => self.cmd("open_help", .{}),
|
nc.key.F01 => self.cmd("open_help", .{}),
|
||||||
nc.key.F06 => self.cmd("open_config", .{}),
|
nc.key.F06 => self.cmd("open_config", .{}),
|
||||||
nc.key.F09 => self.cmd("theme_prev", .{}),
|
nc.key.F09 => self.cmd("theme_prev", .{}),
|
||||||
|
@ -91,6 +99,10 @@ fn cmd(_: *Self, name_: []const u8, ctx: command.Context) tp.result {
|
||||||
try command.executeName(name_, ctx);
|
try command.executeName(name_, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn msg(_: *Self, text: []const u8) tp.result {
|
||||||
|
return tp.self_pid().send(.{ "log", "home", text });
|
||||||
|
}
|
||||||
|
|
||||||
fn cmd_async(_: *Self, name_: []const u8) tp.result {
|
fn cmd_async(_: *Self, name_: []const u8) tp.result {
|
||||||
return tp.self_pid().send(.{ "cmd", name_ });
|
return tp.self_pid().send(.{ "cmd", name_ });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue