diff options
author | Lysandros Nikolaou <lisandrosnik@gmail.com> | 2024-05-22 02:35:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-22 02:35:44 (GMT) |
commit | c886bece3b3a49f8a0f188aecfc1d6ff89d281e6 (patch) | |
tree | 43956c1fc6a1df7b0c124fb0c9845ad364f5239a /Lib/_pyrepl/commands.py | |
parent | d065edfb66470bbf06367b3570661d0346aa6707 (diff) | |
download | cpython-c886bece3b3a49f8a0f188aecfc1d6ff89d281e6.zip cpython-c886bece3b3a49f8a0f188aecfc1d6ff89d281e6.tar.gz cpython-c886bece3b3a49f8a0f188aecfc1d6ff89d281e6.tar.bz2 |
gh-111201: Add append to screen method to avoid recalculation (#119274)
Co-authored-by: Ćukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Lib/_pyrepl/commands.py')
-rw-r--r-- | Lib/_pyrepl/commands.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/_pyrepl/commands.py b/Lib/_pyrepl/commands.py index 51c7afe..3d9722d 100644 --- a/Lib/_pyrepl/commands.py +++ b/Lib/_pyrepl/commands.py @@ -358,7 +358,10 @@ class backward_word(MotionCommand): class self_insert(EditCommand): def do(self) -> None: r = self.reader - r.insert(self.event * r.get_arg()) + text = self.event * r.get_arg() + r.insert(text) + if len(text) == 1 and r.pos == len(r.buffer): + r.calc_screen = r.append_to_screen class insert_nl(EditCommand): |