summaryrefslogtreecommitdiffstats
path: root/Lib/_pyrepl/commands.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-05-22 16:03:04 (GMT)
committerGitHub <noreply@github.com>2024-05-22 16:03:04 (GMT)
commitaefe2e626eeb2f05cda10a17926f8ba9b7a504ca (patch)
treed49408a37d65ab1ee30e2ba7887adc1a6b697a6d /Lib/_pyrepl/commands.py
parentac9163637b028fc4b457f83b1a49b2f7ffbff6e6 (diff)
downloadcpython-aefe2e626eeb2f05cda10a17926f8ba9b7a504ca.zip
cpython-aefe2e626eeb2f05cda10a17926f8ba9b7a504ca.tar.gz
cpython-aefe2e626eeb2f05cda10a17926f8ba9b7a504ca.tar.bz2
[3.13] gh-111201: Add append to screen method to avoid recalculation (GH-119274) (#119405)
(cherry picked from commit c886bece3b3a49f8a0f188aecfc1d6ff89d281e6) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Lib/_pyrepl/commands.py')
-rw-r--r--Lib/_pyrepl/commands.py5
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):