@@ -10,7 +10,7 @@ use crate::{
1010 input:: { Input , InputEvent , InputState } ,
1111 keys:: { KeyConfig , SharedKeyConfig } ,
1212 queue:: { Action , InternalEvent , NeedsUpdate , Queue } ,
13- strings:: { self , commands , order} ,
13+ strings:: { self , order} ,
1414 tabs:: { Revlog , StashList , Stashing , Status } ,
1515 ui:: style:: { SharedTheme , Theme } ,
1616} ;
@@ -71,7 +71,11 @@ impl App {
7171
7272 Self {
7373 input,
74- reset : ResetComponent :: new ( queue. clone ( ) , theme. clone ( ) ) ,
74+ reset : ResetComponent :: new (
75+ queue. clone ( ) ,
76+ theme. clone ( ) ,
77+ key_config. clone ( ) ,
78+ ) ,
7579 commit : CommitComponent :: new (
7680 queue. clone ( ) ,
7781 theme. clone ( ) ,
@@ -80,6 +84,7 @@ impl App {
8084 stashmsg_popup : StashMsgComponent :: new (
8185 queue. clone ( ) ,
8286 theme. clone ( ) ,
87+ key_config. clone ( ) ,
8388 ) ,
8489 inspect_commit_popup : InspectCommitComponent :: new (
8590 & queue,
@@ -89,13 +94,18 @@ impl App {
8994 ) ,
9095 external_editor_popup : ExternalEditorComponent :: new (
9196 theme. clone ( ) ,
97+ key_config. clone ( ) ,
9298 ) ,
9399 tag_commit_popup : TagCommitComponent :: new (
94100 queue. clone ( ) ,
95101 theme. clone ( ) ,
102+ key_config. clone ( ) ,
96103 ) ,
97104 do_quit : false ,
98- cmdbar : RefCell :: new ( CommandBar :: new ( theme. clone ( ) ) ) ,
105+ cmdbar : RefCell :: new ( CommandBar :: new (
106+ theme. clone ( ) ,
107+ key_config. clone ( ) ,
108+ ) ) ,
99109 help : HelpComponent :: new (
100110 theme. clone ( ) ,
101111 key_config. clone ( ) ,
@@ -191,10 +201,10 @@ impl App {
191201 {
192202 self . toggle_tabs ( true ) ?;
193203 NeedsUpdate :: COMMANDS
194- } else if k == self . key_config . tab_1
195- || k == self . key_config . tab_2
196- || k == self . key_config . tab_3
197- || k == self . key_config . tab_4
204+ } else if k == self . key_config . tab_status
205+ || k == self . key_config . tab_log
206+ || k == self . key_config . tab_stashing
207+ || k == self . key_config . tab_stashes
198208 {
199209 self . switch_tab ( k) ?;
200210 NeedsUpdate :: COMMANDS
@@ -360,13 +370,13 @@ impl App {
360370 }
361371
362372 fn switch_tab ( & mut self , k : KeyEvent ) -> Result < ( ) > {
363- if k == self . key_config . tab_1 {
373+ if k == self . key_config . tab_status {
364374 self . set_tab ( 0 ) ?
365- } else if k == self . key_config . tab_2 {
375+ } else if k == self . key_config . tab_log {
366376 self . set_tab ( 1 ) ?
367- } else if k == self . key_config . tab_3 {
377+ } else if k == self . key_config . tab_stashing {
368378 self . set_tab ( 2 ) ?
369- } else if k == self . key_config . tab_4 {
379+ } else if k == self . key_config . tab_stashes {
370380 self . set_tab ( 3 ) ?
371381 }
372382
@@ -479,15 +489,19 @@ impl App {
479489
480490 res. push (
481491 CommandInfo :: new (
482- commands:: TOGGLE_TABS ,
492+ strings:: commands:: toggle_tabs (
493+ self . key_config . clone ( ) ,
494+ ) ,
483495 true ,
484496 !self . any_popup_visible ( ) ,
485497 )
486498 . order ( order:: NAV ) ,
487499 ) ;
488500 res. push (
489501 CommandInfo :: new (
490- commands:: TOGGLE_TABS_DIRECT ,
502+ strings:: commands:: toggle_tabs_direct (
503+ self . key_config . clone ( ) ,
504+ ) ,
491505 true ,
492506 !self . any_popup_visible ( ) ,
493507 )
@@ -496,7 +510,7 @@ impl App {
496510
497511 res. push (
498512 CommandInfo :: new (
499- commands:: QUIT ,
513+ strings :: commands:: quit ( self . key_config . clone ( ) ) ,
500514 true ,
501515 !self . any_popup_visible ( ) ,
502516 )
@@ -552,10 +566,10 @@ impl App {
552566 } ) ;
553567
554568 let tabs = & [
555- strings:: TAB_STATUS ,
556- strings:: TAB_LOG ,
557- strings:: TAB_STASHING ,
558- strings:: TAB_STASHES ,
569+ strings:: tab_status ( self . key_config . clone ( ) ) ,
570+ strings:: tab_log ( self . key_config . clone ( ) ) ,
571+ strings:: tab_stashing ( self . key_config . clone ( ) ) ,
572+ strings:: tab_stashes ( self . key_config . clone ( ) ) ,
559573 ] ;
560574
561575 f. render_widget (
@@ -568,7 +582,9 @@ impl App {
568582 . titles ( tabs)
569583 . style ( self . theme . tab ( false ) )
570584 . highlight_style ( self . theme . tab ( true ) )
571- . divider ( strings:: TAB_DIVIDER )
585+ . divider ( & strings:: tab_divider (
586+ self . key_config . clone ( ) ,
587+ ) )
572588 . select ( self . tab ) ,
573589 r,
574590 ) ;
0 commit comments