mirror of
https://github.com/extrawurst/gitui.git
synced 2024-12-26 18:43:37 +03:00
better key controls
This commit is contained in:
parent
571f45e464
commit
7c454629fe
15
src/app.rs
15
src/app.rs
@ -154,8 +154,13 @@ impl App {
|
|||||||
self.switch_focus(Focus::Status);
|
self.switch_focus(Focus::Status);
|
||||||
} else if ev == Event::Key(keys::FOCUS_STAGE) {
|
} else if ev == Event::Key(keys::FOCUS_STAGE) {
|
||||||
self.switch_focus(Focus::Stage);
|
self.switch_focus(Focus::Stage);
|
||||||
} else if ev == Event::Key(keys::FOCUS_DIFF) {
|
} else if ev == Event::Key(keys::FOCUS_RIGHT) {
|
||||||
self.switch_focus(Focus::Diff);
|
self.switch_focus(Focus::Diff);
|
||||||
|
} else if ev == Event::Key(keys::FOCUS_LEFT) {
|
||||||
|
self.switch_focus(match self.diff_target {
|
||||||
|
DiffTarget::Stage => Focus::Stage,
|
||||||
|
DiffTarget::WorkingDir => Focus::Status,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Event::Key(e) = ev {
|
if let Event::Key(e) = ev {
|
||||||
@ -222,6 +227,14 @@ impl App {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res.push(CommandInfo {
|
||||||
|
name: if self.focus == Focus::Diff {
|
||||||
|
strings::CMD_STATUS_LEFT.to_string()
|
||||||
|
} else {
|
||||||
|
strings::CMD_STATUS_RIGHT.to_string()
|
||||||
|
},
|
||||||
|
enabled: true,
|
||||||
|
});
|
||||||
res.push(CommandInfo {
|
res.push(CommandInfo {
|
||||||
name: strings::CMD_STATUS_QUIT.to_string(),
|
name: strings::CMD_STATUS_QUIT.to_string(),
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
@ -8,5 +8,6 @@ const fn no_mod(code: KeyCode) -> KeyEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub static FOCUS_STATUS: KeyEvent = no_mod(KeyCode::Char('1'));
|
pub static FOCUS_STATUS: KeyEvent = no_mod(KeyCode::Char('1'));
|
||||||
pub static FOCUS_DIFF: KeyEvent = no_mod(KeyCode::Char('2'));
|
pub static FOCUS_STAGE: KeyEvent = no_mod(KeyCode::Char('2'));
|
||||||
pub static FOCUS_STAGE: KeyEvent = no_mod(KeyCode::Char('3'));
|
pub static FOCUS_RIGHT: KeyEvent = no_mod(KeyCode::Right);
|
||||||
|
pub static FOCUS_LEFT: KeyEvent = no_mod(KeyCode::Left);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
pub static TITLE_STATUS: &str = "Status [1]";
|
pub static TITLE_STATUS: &str = "Status [1]";
|
||||||
pub static TITLE_DIFF: &str = "Diff [2]";
|
pub static TITLE_DIFF: &str = "Diff";
|
||||||
pub static TITLE_INDEX: &str = "Index [3]";
|
pub static TITLE_INDEX: &str = "Index [2]";
|
||||||
|
|
||||||
pub static TAB_STATUS: &str = "Status";
|
pub static TAB_STATUS: &str = "Status";
|
||||||
pub static TAB_DIVIDER: &str = " | ";
|
pub static TAB_DIVIDER: &str = " | ";
|
||||||
@ -9,6 +9,8 @@ pub static CMD_STATUS_STAGE: &str = "Stage File [enter]";
|
|||||||
pub static CMD_STATUS_UNSTAGE: &str = "Unstage File [enter]";
|
pub static CMD_STATUS_UNSTAGE: &str = "Unstage File [enter]";
|
||||||
pub static CMD_STATUS_RESET: &str = "Reset File [D]";
|
pub static CMD_STATUS_RESET: &str = "Reset File [D]";
|
||||||
pub static CMD_STATUS_QUIT: &str = "Quit [esc,q]";
|
pub static CMD_STATUS_QUIT: &str = "Quit [esc,q]";
|
||||||
|
pub static CMD_STATUS_LEFT: &str = "Back [←]";
|
||||||
|
pub static CMD_STATUS_RIGHT: &str = "Diff [→]";
|
||||||
pub static CMD_SPLITTER: &str = " ";
|
pub static CMD_SPLITTER: &str = " ";
|
||||||
|
|
||||||
pub static DIFF_CMD_SCROLL: &str = "Scroll [↑↓]";
|
pub static DIFF_CMD_SCROLL: &str = "Scroll [↑↓]";
|
||||||
|
Loading…
Reference in New Issue
Block a user