@@ -14,7 +14,6 @@ pub enum Action {
1414 SwitchPane ( usize ) ,
1515 FocusList ,
1616 FocusDiff ,
17- FocusTerminal ,
1817 CycleForward ,
1918 CycleBackward ,
2019 TermScrollUp ,
@@ -38,16 +37,18 @@ pub fn map_key(event: KeyEvent) -> Action {
3837 KeyCode :: Char ( 'f' ) if ctrl => Action :: ToggleFullscreen ,
3938 KeyCode :: Char ( 'l' ) if ctrl => Action :: ToggleLogView ,
4039 KeyCode :: Char ( 'p' ) if ctrl => Action :: CycleTheme ,
41- KeyCode :: Char ( '1' ) if ctrl => Action :: FocusList ,
42- KeyCode :: Char ( '2' ) if ctrl => Action :: FocusDiff ,
43- KeyCode :: Char ( '3' ) if ctrl => Action :: FocusTerminal ,
4440 KeyCode :: Left if shift => Action :: CycleBackward ,
4541 KeyCode :: Right if shift => Action :: CycleForward ,
4642 KeyCode :: Up if shift => Action :: TermScrollLineUp ,
4743 KeyCode :: Down if shift => Action :: TermScrollLineDown ,
4844 KeyCode :: PageUp if shift => Action :: TermScrollUp ,
4945 KeyCode :: PageDown if shift => Action :: TermScrollDown ,
50- KeyCode :: F ( n @ 1 ..=9 ) => Action :: SwitchPane ( n as usize - 1 ) ,
46+ // F-keys are universally distinct across terminals (no kitty protocol
47+ // dependency), so they own focus jumps: F1=list, F2=diff,
48+ // F3..=F9 = terminal panes 1..=7.
49+ KeyCode :: F ( 1 ) => Action :: FocusList ,
50+ KeyCode :: F ( 2 ) => Action :: FocusDiff ,
51+ KeyCode :: F ( n @ 3 ..=9 ) => Action :: SwitchPane ( n as usize - 3 ) ,
5152 KeyCode :: Up => Action :: Up ,
5253 KeyCode :: Down => Action :: Down ,
5354 KeyCode :: PageUp => Action :: PageUp ,
@@ -217,21 +218,17 @@ mod tests {
217218 }
218219
219220 #[ test]
220- fn maps_switch_pane ( ) {
221- assert_eq ! ( map_key( key( KeyCode :: F ( 1 ) ) ) , Action :: SwitchPane ( 0 ) ) ;
222- assert_eq ! ( map_key( key( KeyCode :: F ( 2 ) ) ) , Action :: SwitchPane ( 1 ) ) ;
223- assert_eq ! ( map_key( key( KeyCode :: F ( 9 ) ) ) , Action :: SwitchPane ( 8 ) ) ;
221+ fn maps_focus_jump_shortcuts ( ) {
222+ assert_eq ! ( map_key( key( KeyCode :: F ( 1 ) ) ) , Action :: FocusList ) ;
223+ assert_eq ! ( map_key( key( KeyCode :: F ( 2 ) ) ) , Action :: FocusDiff ) ;
224224 }
225225
226226 #[ test]
227- fn maps_focus_jump_shortcuts ( ) {
228- assert_eq ! ( map_key( ctrl( KeyCode :: Char ( '1' ) ) ) , Action :: FocusList ) ;
229- assert_eq ! ( map_key( ctrl( KeyCode :: Char ( '2' ) ) ) , Action :: FocusDiff ) ;
230- assert_eq ! ( map_key( ctrl( KeyCode :: Char ( '3' ) ) ) , Action :: FocusTerminal ) ;
231- // Plain digits must not steal focus from the underlying view.
232- assert_eq ! ( map_key( key( KeyCode :: Char ( '1' ) ) ) , Action :: None ) ;
233- assert_eq ! ( map_key( key( KeyCode :: Char ( '2' ) ) ) , Action :: None ) ;
234- assert_eq ! ( map_key( key( KeyCode :: Char ( '3' ) ) ) , Action :: None ) ;
227+ fn maps_switch_pane ( ) {
228+ // F3..=F9 directly select terminal panes 0..=6.
229+ assert_eq ! ( map_key( key( KeyCode :: F ( 3 ) ) ) , Action :: SwitchPane ( 0 ) ) ;
230+ assert_eq ! ( map_key( key( KeyCode :: F ( 4 ) ) ) , Action :: SwitchPane ( 1 ) ) ;
231+ assert_eq ! ( map_key( key( KeyCode :: F ( 9 ) ) ) , Action :: SwitchPane ( 6 ) ) ;
235232 }
236233
237234 #[ test]
0 commit comments