@@ -431,9 +431,8 @@ def allow_style(self, new_val: str) -> None:
431431 if new_val in [ansi .STYLE_TERMINAL , ansi .STYLE_ALWAYS , ansi .STYLE_NEVER ]:
432432 ansi .allow_style = new_val
433433 else :
434- raise ValueError ('Invalid value: {} (valid values: {}, {}, {})' .format (new_val , ansi .STYLE_TERMINAL ,
435- ansi .STYLE_ALWAYS ,
436- ansi .STYLE_NEVER ))
434+ raise ValueError ("must be {}, {}, or {} (case-insensitive)" .format (ansi .STYLE_TERMINAL , ansi .STYLE_ALWAYS ,
435+ ansi .STYLE_NEVER ))
437436
438437 def _completion_supported (self ) -> bool :
439438 """Return whether tab completion is supported"""
@@ -2886,8 +2885,8 @@ def do_set(self, args: argparse.Namespace) -> None:
28862885 # Try to update the settable's value
28872886 try :
28882887 orig_value = getattr (self , args .param )
2889- new_value = settable .val_type (args .value )
2890- setattr (self , args .param , new_value )
2888+ setattr ( self , args . param , settable .val_type (args .value ) )
2889+ new_value = getattr (self , args .param )
28912890 # noinspection PyBroadException
28922891 except Exception as e :
28932892 err_msg = "Error setting {}: {}" .format (args .param , e )
@@ -3814,9 +3813,6 @@ def async_alert(self, alert_msg: str, new_prompt: Optional[str] = None) -> None:
38143813 # Sanity check that can't fail if self.terminal_lock was acquired before calling this function
38153814 if self .terminal_lock .acquire (blocking = False ):
38163815
3817- # Figure out what prompt is displaying
3818- current_prompt = self .continuation_prompt if self ._at_continuation_prompt else self .prompt
3819-
38203816 # Only update terminal if there are changes
38213817 update_terminal = False
38223818
@@ -3835,6 +3831,8 @@ def async_alert(self, alert_msg: str, new_prompt: Optional[str] = None) -> None:
38353831
38363832 if update_terminal :
38373833 import shutil
3834+
3835+ current_prompt = self .continuation_prompt if self ._at_continuation_prompt else self .prompt
38383836 terminal_str = ansi .async_alert_str (terminal_columns = shutil .get_terminal_size ().columns ,
38393837 prompt = current_prompt , line = readline .get_line_buffer (),
38403838 cursor_offset = rl_get_point (), alert_msg = alert_msg )
@@ -3867,9 +3865,9 @@ def async_update_prompt(self, new_prompt: str) -> None: # pragma: no cover
38673865 a prompt is onscreen. Therefore it is best to acquire the lock before calling this function
38683866 to guarantee the prompt changes.
38693867
3870- If a continuation prompt is currently being displayed while entering a multiline
3871- command, the onscreen prompt will not change. However self.prompt will still be updated
3872- and display immediately after the multiline line command completes.
3868+ If user is at a continuation prompt while entering a multiline command, the onscreen prompt will
3869+ not change. However self.prompt will still be updated and display immediately after the multiline
3870+ line command completes.
38733871
38743872 :param new_prompt: what to change the prompt to
38753873 """
0 commit comments