@@ -431,9 +431,8 @@ def allow_style(self, new_val: str) -> None:
431
431
if new_val in [ansi .STYLE_TERMINAL , ansi .STYLE_ALWAYS , ansi .STYLE_NEVER ]:
432
432
ansi .allow_style = new_val
433
433
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 ))
437
436
438
437
def _completion_supported (self ) -> bool :
439
438
"""Return whether tab completion is supported"""
@@ -2886,8 +2885,8 @@ def do_set(self, args: argparse.Namespace) -> None:
2886
2885
# Try to update the settable's value
2887
2886
try :
2888
2887
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 )
2891
2890
# noinspection PyBroadException
2892
2891
except Exception as e :
2893
2892
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:
3814
3813
# Sanity check that can't fail if self.terminal_lock was acquired before calling this function
3815
3814
if self .terminal_lock .acquire (blocking = False ):
3816
3815
3817
- # Figure out what prompt is displaying
3818
- current_prompt = self .continuation_prompt if self ._at_continuation_prompt else self .prompt
3819
-
3820
3816
# Only update terminal if there are changes
3821
3817
update_terminal = False
3822
3818
@@ -3835,6 +3831,8 @@ def async_alert(self, alert_msg: str, new_prompt: Optional[str] = None) -> None:
3835
3831
3836
3832
if update_terminal :
3837
3833
import shutil
3834
+
3835
+ current_prompt = self .continuation_prompt if self ._at_continuation_prompt else self .prompt
3838
3836
terminal_str = ansi .async_alert_str (terminal_columns = shutil .get_terminal_size ().columns ,
3839
3837
prompt = current_prompt , line = readline .get_line_buffer (),
3840
3838
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
3867
3865
a prompt is onscreen. Therefore it is best to acquire the lock before calling this function
3868
3866
to guarantee the prompt changes.
3869
3867
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.
3873
3871
3874
3872
:param new_prompt: what to change the prompt to
3875
3873
"""
0 commit comments