File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -619,6 +619,16 @@ def suspend(self) -> SimpleContextManager:
619619 setattr (self , arg , prev_state [arg ])
620620 self .prepare ()
621621
622+ @contextmanager
623+ def suspend_colorization (self ) -> SimpleContextManager :
624+ try :
625+ old_can_colorize = self .can_colorize
626+ self .can_colorize = False
627+ yield
628+ finally :
629+ self .can_colorize = old_can_colorize
630+
631+
622632 def finish (self ) -> None :
623633 """Called when a command signals that we're finished."""
624634 pass
Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ def maybe_run_command(statement: str) -> bool:
125125 command = REPL_COMMANDS [statement ]
126126 if callable (command ):
127127 # Make sure that history does not change because of commands
128- with reader .suspend_history ():
128+ with reader .suspend_history (), reader . suspend_colorization () :
129129 command ()
130130 return True
131131 return False
You can’t perform that action at this time.
0 commit comments