Skip to content

Commit fc1cf63

Browse files
fix send_current_block_to_external_editor
1 parent 812d7ee commit fc1cf63

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ def down_one_line(self):
594594
self._set_cursor_offset(len(self.current_line), reset_rl_history=False)
595595

596596
def process_simple_keypress(self, e):
597-
if e in (u"<Ctrl-j>", u"<Ctrl-m>", u"<PADENTER>"):
597+
if e in (u"<Ctrl-j>", u"<Ctrl-m>", u"<PADENTER>", u"\n", u"\r"): # '\n' necessary for pastes
598598
self.on_enter()
599599
while self.fake_refresh_requested:
600600
self.fake_refresh_requested = False
@@ -607,7 +607,7 @@ def process_simple_keypress(self, e):
607607
self.add_normal_character(e)
608608

609609
def send_current_block_to_external_editor(self, filename=None):
610-
text = self.send_to_external_editor(self.get_current_block())
610+
text = self.send_to_external_editor(self.get_current_block().encode('utf8'))
611611
lines = [line for line in text.split('\n')]
612612
while lines and not lines[-1].split():
613613
lines.pop()
@@ -616,7 +616,6 @@ def send_current_block_to_external_editor(self, filename=None):
616616
with self.in_paste_mode():
617617
for e in events:
618618
self.process_simple_keypress(e)
619-
self.current_line = ''
620619
self.cursor_offset = len(self.current_line)
621620

622621
def send_session_to_external_editor(self, filename=None):

0 commit comments

Comments
 (0)