diff options
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r-- | cmd2/cmd2.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 60d5463a..67304636 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -1416,10 +1416,12 @@ class Cmd(cmd.Cmd): except IndexError: return None - except CompletionError as e: - err_str = str(e) + except CompletionError as ex: + err_str = str(ex) + # Don't print error and redraw the prompt unless the error has length if err_str: - # Don't print error and redraw the prompt unless the error has length + if ex.apply_style: + err_str = ansi.style_error(err_str) ansi.style_aware_write(sys.stdout, '\n' + err_str + '\n') rl_force_redisplay() return None |