@@ -594,7 +594,7 @@ def down_one_line(self):
594
594
self ._set_cursor_offset (len (self .current_line ), reset_rl_history = False )
595
595
596
596
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
598
598
self .on_enter ()
599
599
while self .fake_refresh_requested :
600
600
self .fake_refresh_requested = False
@@ -607,7 +607,7 @@ def process_simple_keypress(self, e):
607
607
self .add_normal_character (e )
608
608
609
609
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' ) )
611
611
lines = [line for line in text .split ('\n ' )]
612
612
while lines and not lines [- 1 ].split ():
613
613
lines .pop ()
@@ -616,7 +616,6 @@ def send_current_block_to_external_editor(self, filename=None):
616
616
with self .in_paste_mode ():
617
617
for e in events :
618
618
self .process_simple_keypress (e )
619
- self .current_line = ''
620
619
self .cursor_offset = len (self .current_line )
621
620
622
621
def send_session_to_external_editor (self , filename = None ):
0 commit comments