Skip to content

Commit 4f564e8

Browse files
partial fix for enter not working in raw_input
1 parent 2bc2aa7 commit 4f564e8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ def process_event(self, e):
5353
assert self.has_focus
5454
if isinstance(e, events.PasteEvent):
5555
for ee in e.events:
56-
self.add_normal_character(ee)
56+
if ee not in rl_char_sequences:
57+
self.add_input_character(ee)
5758
elif e in rl_char_sequences:
5859
self.cursor_offset_in_line, self.current_line = rl_char_sequences[e](self.cursor_offset_in_line, self.current_line)
5960
elif isinstance(e, events.SigIntEvent):
@@ -65,7 +66,7 @@ def process_event(self, e):
6566
elif e in ["\x1b"]: #ESC
6667
pass
6768
else: # add normal character
68-
self.add_normal_character(e)
69+
self.add_input_character(e)
6970

7071
if self.current_line.endswith(("\n", "\r")):
7172
line = self.current_line
@@ -78,9 +79,8 @@ def process_event(self, e):
7879
else:
7980
self.repl.send_to_stdin(self.current_line)
8081

81-
def add_normal_character(self, e):
82-
if len(e) > 1 or is_nop(e):
83-
return
82+
def add_input_character(self, e):
83+
assert len(e) == 1, 'added multiple characters: %r' % e
8484
logging.debug('adding normal char %r to current line', e)
8585
c = e if py3 else e.encode('utf8')
8686
self.current_line = (self.current_line[:self.cursor_offset_in_line] +

0 commit comments

Comments
 (0)