Add configurable shortcut for 'quit'
Quit ('q' button) was hardcoded, switch to configurable shortcut setting instead.jmap-eventsource
parent
d404910a0f
commit
76f8bdc558
|
@ -472,6 +472,10 @@ exit_thread = 'i'
|
||||||
Toggle help and shortcuts view.
|
Toggle help and shortcuts view.
|
||||||
.\" default value
|
.\" default value
|
||||||
.Pq Em \&?
|
.Pq Em \&?
|
||||||
|
.It Ic quit
|
||||||
|
Quit application.
|
||||||
|
.\" default value
|
||||||
|
.Pq Ql Em q
|
||||||
.It Ic enter_command_mode
|
.It Ic enter_command_mode
|
||||||
Enter
|
Enter
|
||||||
.Em COMMAND
|
.Em COMMAND
|
||||||
|
|
|
@ -375,6 +375,7 @@ fn run_app(opt: Opt) -> Result<()> {
|
||||||
.general
|
.general
|
||||||
.enter_command_mode
|
.enter_command_mode
|
||||||
.clone();
|
.clone();
|
||||||
|
let quit_key: Key = state.context.settings.shortcuts.general.quit.clone();
|
||||||
|
|
||||||
/* Keep track of the input mode. See UIMode for details */
|
/* Keep track of the input mode. See UIMode for details */
|
||||||
'main: loop {
|
'main: loop {
|
||||||
|
@ -421,7 +422,7 @@ fn run_app(opt: Opt) -> Result<()> {
|
||||||
match state.mode {
|
match state.mode {
|
||||||
UIMode::Normal => {
|
UIMode::Normal => {
|
||||||
match k {
|
match k {
|
||||||
Key::Char('q') | Key::Char('Q') => {
|
_ if k == quit_key => {
|
||||||
if state.can_quit_cleanly() {
|
if state.can_quit_cleanly() {
|
||||||
drop(state);
|
drop(state);
|
||||||
break 'main;
|
break 'main;
|
||||||
|
|
|
@ -216,6 +216,7 @@ shortcut_key_values! { "general",
|
||||||
pub struct GeneralShortcuts {
|
pub struct GeneralShortcuts {
|
||||||
toggle_help |> "Toggle help and shortcuts view." |> Key::Char('?'),
|
toggle_help |> "Toggle help and shortcuts view." |> Key::Char('?'),
|
||||||
enter_command_mode |> "Enter COMMAND mode." |> Key::Char(':'),
|
enter_command_mode |> "Enter COMMAND mode." |> Key::Char(':'),
|
||||||
|
quit |> "Quit meli." |> Key::Char('q'),
|
||||||
go_to_tab |> "Go to the nth tab" |> Key::Alt('n'),
|
go_to_tab |> "Go to the nth tab" |> Key::Alt('n'),
|
||||||
next_tab |> "Next tab." |> Key::Char('T'),
|
next_tab |> "Next tab." |> Key::Char('T'),
|
||||||
scroll_right |> "Generic scroll right (catch-all setting)" |> Key::Right,
|
scroll_right |> "Generic scroll right (catch-all setting)" |> Key::Right,
|
||||||
|
|
|
@ -1034,7 +1034,10 @@ impl State {
|
||||||
Quit => {
|
Quit => {
|
||||||
self.context
|
self.context
|
||||||
.sender
|
.sender
|
||||||
.send(ThreadEvent::Input((Key::Char('q'), vec![b'q'])))
|
.send(ThreadEvent::Input((
|
||||||
|
self.context.settings.shortcuts.general.quit.clone(),
|
||||||
|
vec![],
|
||||||
|
)))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
v => {
|
v => {
|
||||||
|
|
Loading…
Reference in New Issue