Skip to content

Commit 766fc16

Browse files
detect returns in input
1 parent 5255a46 commit 766fc16

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def process_event(self, e):
7171
self.repl.run_code_and_maybe_finish()
7272
elif e in ["<ESC>"]:
7373
pass
74-
elif e in ["\n", "\r"]:
74+
elif e in ["\n", "\r", "<Ctrl-j>", "<Ctrl-m>"]:
7575
line = self.current_line
7676
self.repl.send_to_stdin(line + '\n')
7777
self.has_focus = False
@@ -87,8 +87,11 @@ def process_event(self, e):
8787
self.repl.send_to_stdin(self.current_line)
8888

8989
def add_input_character(self, e):
90+
if e == '<SPACE>': e = ' '
91+
if e.startswith('<') and e.endswith('>'): return
9092
assert len(e) == 1, 'added multiple characters: %r' % e
9193
logger.debug('adding normal char %r to current line', e)
94+
9295
c = e if py3 else e.encode('utf8')
9396
self.current_line = (self.current_line[:self.cursor_offset] +
9497
c +

0 commit comments

Comments
 (0)