Skip to content

Commit 5340625

Browse files
fix bpython#275 keys not handled correctly.
1 parent 32f0ab1 commit 5340625

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
@@ -451,6 +452,8 @@ def send_session_to_external_editor(self, filename=None):
451452
## Handler Helpers
452453
def add_normal_character(self, char):
453454
assert len(char) == 1, repr(char)
455+
if is_nop(char):
456+
return
454457
self._current_line = (self._current_line[:self.cursor_offset_in_line] +
455458
char +
456459
self._current_line[self.cursor_offset_in_line:])
@@ -931,6 +934,9 @@ def getstdout(self):
931934
) if lines else ''
932935
return s
933936

937+
def is_nop(char):
938+
return unicodedata.category(char) == 'Cc'
939+
934940
def compress_paste_event(paste_event):
935941
"""If all events in a paste event are identical and not simple characters, returns one of them
936942

0 commit comments

Comments
 (0)