summaryrefslogtreecommitdiffstats
path: root/Lib/_pyrepl/commands.py
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2024-05-07 16:01:49 (GMT)
committerGitHub <noreply@github.com>2024-05-07 16:01:49 (GMT)
commita94ac566285662b214ca97d74481e07e51ccd7d9 (patch)
tree23f91530e49c539081053dbb0ba63e90a6677414 /Lib/_pyrepl/commands.py
parent26bab423fb6e08f9df23c5c8f55e3d019150c454 (diff)
downloadcpython-a94ac566285662b214ca97d74481e07e51ccd7d9.zip
cpython-a94ac566285662b214ca97d74481e07e51ccd7d9.tar.gz
cpython-a94ac566285662b214ca97d74481e07e51ccd7d9.tar.bz2
gh-111201: Allow pasted code to contain multiple statements in the REPL (#118712)
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 bb6bebac..456cba0 100644
--- a/Lib/_pyrepl/commands.py
+++ b/Lib/_pyrepl/commands.py
@@ -460,6 +460,8 @@ class show_history(Command):
class paste_mode(Command):
def do(self) -> None:
+ if not self.reader.paste_mode:
+ self.reader.was_paste_mode_activated = True
self.reader.paste_mode = not self.reader.paste_mode
self.reader.dirty = True
@@ -467,8 +469,9 @@ class paste_mode(Command):
class enable_bracketed_paste(Command):
def do(self) -> None:
self.reader.paste_mode = True
+ self.reader.was_paste_mode_activated = True
class disable_bracketed_paste(Command):
def do(self) -> None:
self.reader.paste_mode = False
- self.reader.insert("\n")
+ self.reader.dirty = True