diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-06-30 18:14:48 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-06-30 18:14:48 -0400 |
commit | 8417cfed896aa21753b55dce8be6ab8848edc6b3 (patch) | |
tree | 0778c0d52d9842224cb33d411e39d195443d73b4 /cmd2/cmd2.py | |
parent | 5074f2573b08f4f44ab3a41ac7a450c4844dcd3d (diff) | |
download | cmd2-git-8417cfed896aa21753b55dce8be6ab8848edc6b3.tar.gz |
Refactored ansi.async_alert_str() so that the cursor offset within the readline buffer is passed in
This way, the function is independent of readline and can more easily be unit tested
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r-- | cmd2/cmd2.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 77af3910..217a92c8 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -52,7 +52,7 @@ from .history import History, HistoryItem from .parsing import StatementParser, Statement, Macro, MacroArg, shlex_split # Set up readline -from .rl_utils import rl_type, RlType, rl_set_prompt, vt100_support, rl_make_safe_prompt +from .rl_utils import rl_type, RlType, rl_get_point, rl_set_prompt, vt100_support, rl_make_safe_prompt if rl_type == RlType.NONE: # pragma: no cover rl_warning = "Readline features including tab completion have been disabled since no \n" \ @@ -3801,7 +3801,7 @@ class Cmd(cmd.Cmd): if update_terminal: terminal_str = ansi.async_alert_str(prompt=current_prompt, line=readline.get_line_buffer(), - alert_msg=alert_msg) + cursor_offset=rl_get_point(), alert_msg=alert_msg) if rl_type == RlType.GNU: sys.stderr.write(terminal_str) elif rl_type == RlType.PYREADLINE: |