@@ -14,6 +14,7 @@ use crate::{
1414 input:: { Input , InputEvent , InputState } ,
1515 keys:: { KeyConfig , SharedKeyConfig } ,
1616 queue:: { Action , InternalEvent , NeedsUpdate , Queue } ,
17+ setup_popups,
1718 strings:: { self , order} ,
1819 tabs:: { Revlog , StashList , Stashing , Status } ,
1920 ui:: style:: { SharedTheme , Theme } ,
@@ -412,6 +413,29 @@ impl App {
412413 ]
413414 ) ;
414415
416+ setup_popups ! (
417+ self ,
418+ [
419+ commit,
420+ help,
421+ reset,
422+ msg,
423+ stashmsg_popup,
424+ inspect_commit_popup,
425+ blame_file_popup,
426+ external_editor_popup,
427+ tag_commit_popup,
428+ create_branch_popup,
429+ push_popup,
430+ push_tags_popup,
431+ pull_popup,
432+ select_branch_popup,
433+ tags_popup,
434+ rename_branch_popup,
435+ revision_files_popup
436+ ]
437+ ) ;
438+
415439 fn check_quit_key ( & mut self , ev : Event ) -> bool {
416440 if let Event :: Key ( e) = ev {
417441 if e == self . key_config . exit {
@@ -714,63 +738,6 @@ impl App {
714738 res
715739 }
716740
717- //TODO: make this automatic, i keep forgetting to add popups here
718- fn any_popup_visible ( & self ) -> bool {
719- self . commit . is_visible ( )
720- || self . help . is_visible ( )
721- || self . reset . is_visible ( )
722- || self . msg . is_visible ( )
723- || self . stashmsg_popup . is_visible ( )
724- || self . inspect_commit_popup . is_visible ( )
725- || self . blame_file_popup . is_visible ( )
726- || self . external_editor_popup . is_visible ( )
727- || self . tag_commit_popup . is_visible ( )
728- || self . create_branch_popup . is_visible ( )
729- || self . push_popup . is_visible ( )
730- || self . push_tags_popup . is_visible ( )
731- || self . pull_popup . is_visible ( )
732- || self . select_branch_popup . is_visible ( )
733- || self . tags_popup . is_visible ( )
734- || self . rename_branch_popup . is_visible ( )
735- || self . revision_files_popup . is_visible ( )
736- }
737-
738- fn draw_popups < B : Backend > (
739- & self ,
740- f : & mut Frame < B > ,
741- ) -> Result < ( ) > {
742- let size = Layout :: default ( )
743- . direction ( Direction :: Vertical )
744- . constraints (
745- [
746- Constraint :: Min ( 1 ) ,
747- Constraint :: Length ( self . cmdbar . borrow ( ) . height ( ) ) ,
748- ]
749- . as_ref ( ) ,
750- )
751- . split ( f. size ( ) ) [ 0 ] ;
752-
753- self . commit . draw ( f, size) ?;
754- self . stashmsg_popup . draw ( f, size) ?;
755- self . help . draw ( f, size) ?;
756- self . inspect_commit_popup . draw ( f, size) ?;
757- self . blame_file_popup . draw ( f, size) ?;
758- self . external_editor_popup . draw ( f, size) ?;
759- self . tag_commit_popup . draw ( f, size) ?;
760- self . select_branch_popup . draw ( f, size) ?;
761- self . tags_popup . draw ( f, size) ?;
762- self . create_branch_popup . draw ( f, size) ?;
763- self . rename_branch_popup . draw ( f, size) ?;
764- self . revision_files_popup . draw ( f, size) ?;
765- self . push_popup . draw ( f, size) ?;
766- self . push_tags_popup . draw ( f, size) ?;
767- self . pull_popup . draw ( f, size) ?;
768- self . reset . draw ( f, size) ?;
769- self . msg . draw ( f, size) ?;
770-
771- Ok ( ( ) )
772- }
773-
774741 //TODO: make this dynamic
775742 fn draw_tabs < B : Backend > ( & self , f : & mut Frame < B > , r : Rect ) {
776743 let r = r. inner ( & Margin {
0 commit comments