Skip to content

Commit 78ff629

Browse files
committed
Merged in thomasballinger/bpython (pull request bpython#44)
fix bpython#275 keys not handled correctly
2 parents 473e7e6 + 5340625 commit 78ff629

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import re
88
import sys
99
import threading
10+
import unicodedata
1011

1112
from bpython.autocomplete import Autocomplete, SIMPLE
1213
from bpython.repl import Repl as BpythonRepl
@@ -453,6 +454,8 @@ def send_session_to_external_editor(self, filename=None):
453454
## Handler Helpers
454455
def add_normal_character(self, char):
455456
assert len(char) == 1, repr(char)
457+
if is_nop(char):
458+
return
456459
self._current_line = (self._current_line[:self.cursor_offset_in_line] +
457460
char +
458461
self._current_line[self.cursor_offset_in_line:])
@@ -938,6 +941,9 @@ def getstdout(self):
938941
) if lines else ''
939942
return s
940943

944+
def is_nop(char):
945+
return unicodedata.category(char) == 'Cc'
946+
941947
def compress_paste_event(paste_event):
942948
"""If all events in a paste event are identical and not simple characters, returns one of them
943949

0 commit comments

Comments
 (0)