@@ -529,7 +529,7 @@ def __init__(
529529
530530 # Cache for prompt_toolkit completion menu styles
531531 self ._cached_pt_style : PtStyle | None = None
532- self ._cached_pt_style_params : tuple [StyleType , StyleType ] | None = None
532+ self ._cached_pt_style_params : tuple [StyleType , StyleType , StyleType , StyleType , StyleType ] | None = None
533533
534534 # Create the main PromptSession
535535 self .bottom_toolbar = bottom_toolbar
@@ -725,24 +725,33 @@ def _should_continue_multiline(self) -> bool:
725725 return False
726726
727727 def _get_pt_style (self ) -> "PtStyle" :
728- """Return the prompt_toolkit style for the completion menu ."""
728+ """Return the cached prompt_toolkit style."""
729729 theme = ru .get_theme ()
730- rich_item_style = theme .styles .get (Cmd2Style .COMPLETION_MENU_ITEM , "" )
730+ rich_menu_style = theme .styles .get (Cmd2Style .COMPLETION_MENU , "" )
731+ rich_completion_style = theme .styles .get (Cmd2Style .COMPLETION_MENU_COMPLETION , "" )
732+ rich_current_style = theme .styles .get (Cmd2Style .COMPLETION_MENU_CURRENT , "" )
731733 rich_meta_style = theme .styles .get (Cmd2Style .COMPLETION_MENU_META , "" )
734+ rich_meta_current_style = theme .styles .get (Cmd2Style .COMPLETION_MENU_META_CURRENT , "" )
732735
733- current_params = (rich_item_style , rich_meta_style )
736+ current_params = (rich_menu_style , rich_completion_style , rich_current_style , rich_meta_style , rich_meta_current_style )
734737 if self ._cached_pt_style is not None and self ._cached_pt_style_params == current_params :
735738 return self ._cached_pt_style
736739
737- item_style = rich_to_pt_style (rich_item_style )
740+ menu_style = rich_to_pt_style (rich_menu_style )
741+ completion_style = rich_to_pt_style (rich_completion_style )
742+ current_style = rich_to_pt_style (rich_current_style )
738743 meta_style = rich_to_pt_style (rich_meta_style )
744+ meta_current_style = rich_to_pt_style (rich_meta_current_style )
739745
740746 self ._cached_pt_style_params = current_params
741747 self ._cached_pt_style = PtStyle .from_dict (
742748 {
743- "completion-menu.completion.current" : item_style ,
744- "completion-menu.meta.completion.current" : meta_style ,
745- "completion-menu.multi-column-meta" : meta_style ,
749+ "completion-menu" : menu_style ,
750+ "completion-menu.completion" : completion_style ,
751+ "completion-menu.completion.current" : current_style ,
752+ "completion-menu.meta.completion" : meta_style ,
753+ "completion-menu.meta.completion.current" : meta_current_style ,
754+ "completion-menu.multi-column-meta" : meta_current_style ,
746755 }
747756 )
748757
0 commit comments