mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 01:18:21 +00:00
fix home/end buttons on diff and add home button on file list (#43)
This commit is contained in:
parent
5b25abace5
commit
5fc8d72ed6
4 changed files with 25 additions and 4 deletions
|
|
@ -358,6 +358,12 @@ impl Component for ChangesComponent {
|
|||
keys::MOVE_UP => {
|
||||
self.move_selection(MoveSelection::Up)
|
||||
}
|
||||
keys::HOME => {
|
||||
self.move_selection(MoveSelection::Home)
|
||||
}
|
||||
keys::SHIFT_UP => {
|
||||
self.move_selection(MoveSelection::Home)
|
||||
}
|
||||
keys::MOVE_LEFT => {
|
||||
self.move_selection(MoveSelection::Left)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -374,11 +374,19 @@ impl Component for DiffComponent {
|
|||
self.scroll(ScrollType::Down);
|
||||
true
|
||||
}
|
||||
KeyCode::End | KeyCode::Down if has_shift => {
|
||||
KeyCode::Down if has_shift => {
|
||||
self.scroll(ScrollType::End);
|
||||
true
|
||||
}
|
||||
KeyCode::Home | KeyCode::Up if has_shift => {
|
||||
KeyCode::End => {
|
||||
self.scroll(ScrollType::End);
|
||||
true
|
||||
}
|
||||
KeyCode::Up if has_shift => {
|
||||
self.scroll(ScrollType::Home);
|
||||
true
|
||||
}
|
||||
KeyCode::Home => {
|
||||
self.scroll(ScrollType::Home);
|
||||
true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,10 @@ pub enum MoveSelection {
|
|||
Down,
|
||||
Left,
|
||||
Right,
|
||||
Home,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
struct SelectionChange {
|
||||
new_index: usize,
|
||||
changes: bool,
|
||||
|
|
@ -70,13 +72,15 @@ impl StatusTree {
|
|||
MoveSelection::Right => {
|
||||
self.selection_right(selection)
|
||||
}
|
||||
MoveSelection::Home => SelectionChange::new(0, false),
|
||||
};
|
||||
|
||||
let changed = selection_change.new_index != selection;
|
||||
let changed_index =
|
||||
selection_change.new_index != selection;
|
||||
|
||||
self.selection = Some(selection_change.new_index);
|
||||
|
||||
changed || selection_change.changes
|
||||
changed_index || selection_change.changes
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,11 @@ pub const OPEN_COMMIT: KeyEvent = no_mod(KeyCode::Char('c'));
|
|||
pub const OPEN_HELP: KeyEvent = no_mod(KeyCode::Char('h'));
|
||||
pub const MOVE_LEFT: KeyEvent = no_mod(KeyCode::Left);
|
||||
pub const MOVE_RIGHT: KeyEvent = no_mod(KeyCode::Right);
|
||||
pub const HOME: KeyEvent = no_mod(KeyCode::Home);
|
||||
pub const MOVE_UP: KeyEvent = no_mod(KeyCode::Up);
|
||||
pub const MOVE_DOWN: KeyEvent = no_mod(KeyCode::Down);
|
||||
pub const SHIFT_UP: KeyEvent =
|
||||
with_mod(KeyCode::Up, KeyModifiers::SHIFT);
|
||||
pub const STATUS_STAGE_FILE: KeyEvent = no_mod(KeyCode::Enter);
|
||||
pub const STATUS_RESET_FILE: KeyEvent =
|
||||
with_mod(KeyCode::Char('D'), KeyModifiers::SHIFT);
|
||||
|
|
|
|||
Loading…
Reference in a new issue