##// END OF EJS Templates
Started fwd_unicode_match() function
Luciana da Costa Marques -
Show More
@@ -1984,6 +1984,7 b' class IPCompleter(Completer):'
1984 return latex_text, latex_matches, ['latex_matches']*len(latex_matches), ()
1984 return latex_text, latex_matches, ['latex_matches']*len(latex_matches), ()
1985 name_text = ''
1985 name_text = ''
1986 name_matches = []
1986 name_matches = []
1987 # need to add self.fwd_unicode_match() function here when done
1987 for meth in (self.unicode_name_matches, back_latex_name_matches, back_unicode_name_matches):
1988 for meth in (self.unicode_name_matches, back_latex_name_matches, back_unicode_name_matches):
1988 name_text, name_matches = meth(base_text)
1989 name_text, name_matches = meth(base_text)
1989 completion_text, completion_matches = self.fwd_unicode_match(base_text)
1990 completion_text, completion_matches = self.fwd_unicode_match(base_text)
@@ -2062,14 +2063,23 b' class IPCompleter(Completer):'
2062 self.matches = _matches
2063 self.matches = _matches
2063
2064
2064 return text, _matches, origins, completions
2065 return text, _matches, origins, completions
2065
2066
2066 def fwd_unicode_match(self, text:str) -> Tuple[str, list]:
2067 def fwd_unicode_match(self, text:str) -> Tuple[str, list]:
2067 # `text` is what the user typed. If it start with `\`,
2068 # initial code based on latex_matches() method
2068 # then lookup in `names` (defined above), all the possible candidates.
2069 slashpos = text.rfind('\\')
2069 # return text, [list of candidates]
2070 # if text starts with slash
2070 unicode_matches = []
2071 if slashpos > -1:
2071 if (text[0] == "\\"):
2072 s = text[slashpos:]
2072 # lookup in names
2073 # check if s is already a unicode, maybe this is not necessary
2073 pass
2074 try unicodedata.lookup(s):
2075 # need to find the unicodes equivalent list to latex_symbols
2076 return s, [latex_symbols[s]]
2077 except KeyError:
2078 return u'', []
2079 # need to find the unicode equivalent to latex_symbols and do something similar
2080 matches = [k for k in latex_symbols if k.startswith(s)]
2081 return s, matches
2082
2083 # if text does not start with slash
2074 else:
2084 else:
2075 return [text,unicode_matches]
2085 return u'', [] No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now