Skip to content

Commit 5b27b88

Browse files
keep control-d as exit on empty line
1 parent f59210e commit 5b27b88

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

bpython/curtsiesfrontend/manual_readline.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def last_word_pos(string):
6060
return index or 0
6161

6262
@on('<PADDELETE>')
63-
@on('<Ctrl-d>')
6463
def delete(cursor_offset, line):
6564
return (cursor_offset,
6665
line[:cursor_offset] + line[cursor_offset+1:])

bpython/curtsiesfrontend/repl.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,10 @@ def process_event(self, e):
492492
elif e in ("<Ctrl-d>",):
493493
if self.current_line == '':
494494
raise SystemExit()
495+
else:
496+
self.current_line = self.current_line[:self.cursor_offset] + self.current_line[self.cursor_offset+1:]
497+
self.update_completion()
498+
self.rl_history.reset()
495499
elif e in key_dispatch[self.config.exit_key]:
496500
raise SystemExit()
497501
elif e in ("\n", "\r", "<PADENTER>", "<Ctrl-j>", "<Ctrl-m>"):

0 commit comments

Comments
 (0)