From ad0ed001cbf708b10e38a0cba61c3af8032feb79 2019-02-05 01:17:59 From: Luciana da Costa Marques Date: 2019-02-05 01:17:59 Subject: [PATCH] add @Carraeu suggestions --- diff --git a/IPython/core/completer.py b/IPython/core/completer.py index 5e6868a..7932d85 100644 --- a/IPython/core/completer.py +++ b/IPython/core/completer.py @@ -168,6 +168,12 @@ MATCHES_LIMIT = 500 _deprecation_readline_sentinel = object() +names = [] +for c in range(0,0x10FFFF + 1): + try: + names.append(unicodedata.name(char(c))) + except ValueError: + pass class ProvisionalCompleterWarning(FutureWarning): """ @@ -2065,20 +2071,12 @@ class IPCompleter(Completer): return text, _matches, origins, completions def fwd_unicode_match(self, text:str) -> Tuple[str, list]: - # initial code based on latex_matches() method + # initial code based on latex_matches() method slashpos = text.rfind('\\') # if text starts with slash if slashpos > -1: - s = text[slashpos:] - # check if s is already a unicode, maybe this is not necessary - try unicodedata.lookup(s): - # need to find the unicodes equivalent list to latex_symbols - return s, [latex_symbols[s]] - except KeyError: - return u'', [] - # need to find the unicode equivalent to latex_symbols and do something similar - matches = [k for k in latex_symbols if k.startswith(s)] - return s, matches + s = text[slashpos+1:] + return s, [x for x in names if x.startswith(s)] # if text does not start with slash else: