Radish alpha
r
rad:z39mP9rQAaGmERfUMPULfPUi473tY
Radicle terminal user interface
Radicle
Git
feat(bin): Quit on 'q' across all commands
Erik Kundt committed 1 year ago
commit 2d4a06d9fad3d628981725eeb10f9ae93f337353
parent 0e7579b
4 files changed +15 -11
modified bin/commands/inbox/list.rs
@@ -340,7 +340,7 @@ fn browser_page(_state: &State, channel: &Channel<Message>) -> Widget<State, Mes

            if props.handle_keys {
                match key {
-
                    Key::Esc | Key::Ctrl('c') => Some(Message::Exit { selection: None }),
+
                    Key::Char('q') | Key::Ctrl('c') => Some(Message::Exit { selection: None }),
                    Key::Char('?') => Some(Message::OpenHelp),
                    _ => None,
                }
@@ -413,7 +413,7 @@ fn help_page(_state: &State, channel: &Channel<Message>) -> Widget<State, Messag
        .shortcuts(shortcuts)
        .to_widget(tx.clone())
        .on_event(|key, _, _| match key {
-
            Key::Esc | Key::Ctrl('c') => Some(Message::Exit { selection: None }),
+
            Key::Char('q') | Key::Ctrl('c') => Some(Message::Exit { selection: None }),
            Key::Char('?') => Some(Message::LeavePage),
            _ => None,
        })
@@ -429,7 +429,8 @@ fn help_text() -> String {
`PageDown`: move cursor one page down
`Home`:     move cursor to the first line
`End`:      move cursor to the last line
-
`Esc`:      Quit / cancel
+
`Esc`:      Cancel
+
`q`:        Quit

# Specific keybindings

modified bin/commands/issue/list.rs
@@ -438,7 +438,7 @@ fn browser_page(channel: &Channel<Message>) -> Widget<State, Message> {

            if props.handle_keys {
                match key {
-
                    Key::Esc | Key::Ctrl('c') => Some(Message::Quit),
+
                    Key::Char('q') | Key::Ctrl('c') => Some(Message::Quit),
                    Key::Char('p') => Some(Message::TogglePreview),
                    Key::Char('?') => Some(Message::OpenHelp),
                    Key::Char('\n') => Some(Message::ExitFromMode),
@@ -644,7 +644,7 @@ fn help_page(channel: &Channel<Message>) -> Widget<State, Message> {
        .shortcuts(shortcuts)
        .to_widget(tx.clone())
        .on_event(|key, _, _| match key {
-
            Key::Esc | Key::Ctrl('c') => Some(Message::Quit),
+
            Key::Char('q') | Key::Ctrl('c') => Some(Message::Quit),
            Key::Char('?') => Some(Message::LeavePage),
            _ => None,
        })
@@ -662,7 +662,8 @@ fn help_text() -> String {
`End`:      move cursor to the last line
`Tab`:      focus next section
`BackTab`:  focus previous section
-
`Esc`:      Quit / cancel
+
`Esc`:      Cancel
+
`q`:        Quit

# Specific keybindings

modified bin/commands/patch/list.rs
@@ -257,7 +257,7 @@ fn browser_page(_state: &State, channel: &Channel<Message>) -> Widget<State, Mes

            if props.handle_keys {
                match key {
-
                    Key::Esc | Key::Ctrl('c') => Some(Message::Quit),
+
                    Key::Char('q') | Key::Ctrl('c') => Some(Message::Quit),
                    Key::Char('?') => Some(Message::OpenHelp),
                    Key::Char('\n') => Some(Message::ExitFromMode),
                    Key::Char('c') => Some(Message::Exit {
@@ -354,7 +354,8 @@ fn help_text() -> String {
`PageDown`: move cursor one page down
`Home`:     move cursor to the first line
`End`:      move cursor to the last line
-
`Esc`:      Quit / cancel
+
`Esc`:      Cancel
+
`q`:        Quit

# Specific keybindings

modified bin/commands/patch/list/imui.rs
@@ -32,7 +32,8 @@ const HELP: &str = r#"# Generic keybindings
`PageDown`: move cursor one page down
`Home`:     move cursor to the first line
`End`:      move cursor to the last line
-
`Esc`:      Quit / cancel
+
`Esc`:      Cancel
+
`q`:        Quit

# Specific keybindings

@@ -285,7 +286,7 @@ impl Show<Message> for App {
                                    );
                                });

-
                                if ui.input_global(|key| key == Key::Esc) {
+
                                if ui.input_global(|key| key == Key::Char('q')) {
                                    ui.send_message(Message::Quit);
                                }
                                if ui.input_global(|key| key == Key::Char('?')) {
@@ -366,7 +367,7 @@ impl Show<Message> for App {
                    if ui.input_global(|key| key == Key::Char('?')) {
                        ui.send_message(Message::PageChanged { page: Page::Main });
                    }
-
                    if ui.input_global(|key| key == Key::Esc) {
+
                    if ui.input_global(|key| key == Key::Char('q')) {
                        ui.send_message(Message::Quit);
                    }
                }