File tree Expand file tree Collapse file tree 4 files changed +25
-4
lines changed Expand file tree Collapse file tree 4 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -358,6 +358,12 @@ impl Component for ChangesComponent {
358
358
keys:: MOVE_UP => {
359
359
self . move_selection ( MoveSelection :: Up )
360
360
}
361
+ keys:: HOME => {
362
+ self . move_selection ( MoveSelection :: Home )
363
+ }
364
+ keys:: SHIFT_UP => {
365
+ self . move_selection ( MoveSelection :: Home )
366
+ }
361
367
keys:: MOVE_LEFT => {
362
368
self . move_selection ( MoveSelection :: Left )
363
369
}
Original file line number Diff line number Diff line change @@ -374,11 +374,19 @@ impl Component for DiffComponent {
374
374
self . scroll ( ScrollType :: Down ) ;
375
375
true
376
376
}
377
- KeyCode :: End | KeyCode :: Down if has_shift => {
377
+ KeyCode :: Down if has_shift => {
378
378
self . scroll ( ScrollType :: End ) ;
379
379
true
380
380
}
381
- KeyCode :: Home | KeyCode :: Up if has_shift => {
381
+ KeyCode :: End => {
382
+ self . scroll ( ScrollType :: End ) ;
383
+ true
384
+ }
385
+ KeyCode :: Up if has_shift => {
386
+ self . scroll ( ScrollType :: Home ) ;
387
+ true
388
+ }
389
+ KeyCode :: Home => {
382
390
self . scroll ( ScrollType :: Home ) ;
383
391
true
384
392
}
Original file line number Diff line number Diff line change @@ -18,8 +18,10 @@ pub enum MoveSelection {
18
18
Down ,
19
19
Left ,
20
20
Right ,
21
+ Home ,
21
22
}
22
23
24
+ #[ derive( Copy , Clone , Debug ) ]
23
25
struct SelectionChange {
24
26
new_index : usize ,
25
27
changes : bool ,
@@ -70,13 +72,15 @@ impl StatusTree {
70
72
MoveSelection :: Right => {
71
73
self . selection_right ( selection)
72
74
}
75
+ MoveSelection :: Home => SelectionChange :: new ( 0 , false ) ,
73
76
} ;
74
77
75
- let changed = selection_change. new_index != selection;
78
+ let changed_index =
79
+ selection_change. new_index != selection;
76
80
77
81
self . selection = Some ( selection_change. new_index ) ;
78
82
79
- changed || selection_change. changes
83
+ changed_index || selection_change. changes
80
84
} else {
81
85
false
82
86
}
Original file line number Diff line number Diff line change @@ -27,8 +27,11 @@ pub const OPEN_COMMIT: KeyEvent = no_mod(KeyCode::Char('c'));
27
27
pub const OPEN_HELP : KeyEvent = no_mod ( KeyCode :: Char ( 'h' ) ) ;
28
28
pub const MOVE_LEFT : KeyEvent = no_mod ( KeyCode :: Left ) ;
29
29
pub const MOVE_RIGHT : KeyEvent = no_mod ( KeyCode :: Right ) ;
30
+ pub const HOME : KeyEvent = no_mod ( KeyCode :: Home ) ;
30
31
pub const MOVE_UP : KeyEvent = no_mod ( KeyCode :: Up ) ;
31
32
pub const MOVE_DOWN : KeyEvent = no_mod ( KeyCode :: Down ) ;
33
+ pub const SHIFT_UP : KeyEvent =
34
+ with_mod ( KeyCode :: Up , KeyModifiers :: SHIFT ) ;
32
35
pub const STATUS_STAGE_FILE : KeyEvent = no_mod ( KeyCode :: Enter ) ;
33
36
pub const STATUS_RESET_FILE : KeyEvent =
34
37
with_mod ( KeyCode :: Char ( 'D' ) , KeyModifiers :: SHIFT ) ;
You can’t perform that action at this time.
0 commit comments