mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] gh-133400: Fixed Ctrl+D (^D) behavior in :mod:_pyrepl module (GH-133883) (GH-139850)
(cherry picked from commit 81959a0364)
Co-authored-by: DeepWzh <wzh2012@outlook.com>
Co-authored-by: adam j hartz <adam@smatz.net>
This commit is contained in:
parent
926d734840
commit
de87549eb8
3 changed files with 96 additions and 8 deletions
|
|
@ -420,14 +420,17 @@ class delete(EditCommand):
|
|||
def do(self) -> None:
|
||||
r = self.reader
|
||||
b = r.buffer
|
||||
if (
|
||||
r.pos == 0
|
||||
and len(b) == 0 # this is something of a hack
|
||||
and self.event[-1] == "\004"
|
||||
):
|
||||
r.update_screen()
|
||||
r.console.finish()
|
||||
raise EOFError
|
||||
if self.event[-1] == "\004":
|
||||
if b and b[-1].endswith("\n"):
|
||||
self.finish = True
|
||||
elif (
|
||||
r.pos == 0
|
||||
and len(b) == 0 # this is something of a hack
|
||||
):
|
||||
r.update_screen()
|
||||
r.console.finish()
|
||||
raise EOFError
|
||||
|
||||
for i in range(r.get_arg()):
|
||||
if r.pos != len(b):
|
||||
del b[r.pos]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue