mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-21 18:40:46 +08:00
feat(bin): Quit on 'q' across all commands
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user