Show More
@@ -883,7 +883,7 b' def _safe_isinstance(obj, module, class_name):' | |||
|
883 | 883 | isinstance(obj, getattr(import_module(module), class_name))) |
|
884 | 884 | |
|
885 | 885 | def back_unicode_name_matches(text:str) -> Tuple[str, Sequence[str]]: |
|
886 |
"""Match |
|
|
886 | """Match Unicode characters back to Unicode name | |
|
887 | 887 | |
|
888 | 888 | This does ``☃`` -> ``\\snowman`` |
|
889 | 889 | |
@@ -895,7 +895,12 b' def back_unicode_name_matches(text:str) -> Tuple[str, Sequence[str]]:' | |||
|
895 | 895 | Returns |
|
896 | 896 | ======= |
|
897 | 897 | |
|
898 |
Return a tuple |
|
|
898 | Return a tuple with two elements: | |
|
899 | ||
|
900 | - The Unicode character that was matched (preceded with a backslash), or | |
|
901 | empty string, | |
|
902 | - a sequence (of 1), name for the match Unicode character, preceded by | |
|
903 | backslash, or empty if no match. | |
|
899 | 904 | |
|
900 | 905 | """ |
|
901 | 906 | if len(text)<2: |
@@ -907,11 +912,11 b' def back_unicode_name_matches(text:str) -> Tuple[str, Sequence[str]]:' | |||
|
907 | 912 | char = text[-1] |
|
908 | 913 | # no expand on quote for completion in strings. |
|
909 | 914 | # nor backcomplete standard ascii keys |
|
910 |
if char in string.ascii_letters or char in |
|
|
915 | if char in string.ascii_letters or char in ('"',"'"): | |
|
911 | 916 | return '', () |
|
912 | 917 | try : |
|
913 | 918 | unic = unicodedata.name(char) |
|
914 |
return '\\'+char, |
|
|
919 | return '\\'+char,('\\'+unic,) | |
|
915 | 920 | except KeyError: |
|
916 | 921 | pass |
|
917 | 922 | return '', () |
General Comments 0
You need to be logged in to leave comments.
Login now