Browse Source

conf/shortcuts: add shortcut for COMMAND mode

Replace hardcoded Key value with customisable shortcut
"general.enter_command_mode"
tags/alpha-0.6.0
Manos Pitsidianakis 7 months ago
parent
commit
8b90c7fcb6
Signed by: epilys GPG Key ID: 73627C2F690DF710
3 changed files with 16 additions and 2 deletions
  1. +6
    -0
      meli.conf.5
  2. +8
    -1
      src/bin.rs
  3. +2
    -1
      src/conf/shortcuts.rs

+ 6
- 0
meli.conf.5 View File

@ -441,6 +441,12 @@ exit_thread = 'i'
.Pp
.Em general
.Bl -tag -width 36n
.It Ic enter_command_mode
Enter
.Em COMMAND
mode.
.\" default value
.Pq Ql Em \
.It Ic next_tab
Go to next tab.
.\" default value

+ 8
- 1
src/bin.rs View File

@ -343,6 +343,13 @@ fn run_app(opt: Opt) -> Result<()> {
state.register_component(xdg_notifications);
state.register_component(Box::new(components::notifications::NotificationFilter {}));
}
let enter_command_mode: Key = state
.context
.settings
.shortcuts
.general
.enter_command_mode
.clone();
/* Keep track of the input mode. See UIMode for details */
'main: loop {
@ -397,7 +404,7 @@ fn run_app(opt: Opt) -> Result<()> {
state.redraw();
}
},
Key::Char(' ') => {
_ if k == enter_command_mode => {
state.mode = UIMode::Command;
state.rcv_event(UIEvent::ChangeMode(UIMode::Command));
state.redraw();

+ 2
- 1
src/conf/shortcuts.rs View File

@ -79,7 +79,7 @@ macro_rules! shortcut_key_values {
#[serde(default)]
#[serde(rename = $cname)]
pub struct $name {
$($fname : Key),*
$(pub $fname : Key),*
}
impl $name {
@ -163,6 +163,7 @@ shortcut_key_values! { "pager",
shortcut_key_values! { "general",
pub struct GeneralShortcuts {
enter_command_mode |> "Enter COMMAND mode." |> Key::Char(' '),
go_to_tab |> "Go to the nth tab" |> Key::Alt('n'),
next_tab |> "Next tab." |> Key::Char('T'),
scroll_right |> "Generic scroll right (catch-all setting)" |> Key::Right,

Loading…
Cancel
Save