@@ -29,28 +29,6 @@ def get_line_contents(view, location):
29
29
return view .substr (sublime .Region (view .line (location ).a , location ))
30
30
31
31
32
- def get_unicode_prefix (view , location ):
33
- """
34
- Returns unicode prefix at given location and it's region
35
- or None if there is no unicode prefix
36
- """
37
- cts = get_line_contents (view , location )
38
- res = LIST_PREFIX_RE .match (cts ) or UNICODE_PREFIX_RE .match (cts )
39
- if res :
40
- (full_ , pref_ ) = res .groups ()
41
- return (pref_ , sublime .Region (location - len (full_ ), location ))
42
- else :
43
- return None
44
-
45
-
46
- def is_unicode_prefix (view , location ):
47
- """
48
- Returns True if prefix at given location is prefixed with backslash
49
- """
50
- cts = get_line_contents (view , location )
51
- return (UNICODE_PREFIX_RE .match (cts ) is not None ) or (LIST_PREFIX_RE .match (cts ) is not None )
52
-
53
-
54
32
def is_script (s ):
55
33
"""
56
34
Subscript _... or superscript ^...
@@ -62,14 +40,6 @@ def get_script(s):
62
40
return (s [0 ], list (s [1 :]))
63
41
64
42
65
- def get_list_prefix (s ):
66
- # prefix\abc -> (prefix, [a, b, c])
67
- m = LIST_RE .match (s )
68
- if not m :
69
- return (None , None )
70
- return (m .group ('prefix' ), list (m .group ('list' )))
71
-
72
-
73
43
def enabled (name , default = True ):
74
44
return get_settings ().get (name , default )
75
45
@@ -269,24 +239,6 @@ def run(self, edit):
269
239
self .view .insert (edit , r .a , " " )
270
240
271
241
272
- class UnicodeMathSwap (sublime_plugin .TextCommand ):
273
- def run (self , edit ):
274
- for r in self .view .sel ():
275
- upref = get_unicode_prefix (self .view , self .view .word (r ).b )
276
- sym = symbol_by_name (upref [0 ]) if upref else None
277
- symc = symbol_by_code (u'\\ ' + upref [0 ]) if upref else None
278
- if upref and (sym or symc ):
279
- self .view .replace (edit , upref [1 ], sym or symc )
280
- elif r .b - r .a <= 1 :
281
- u = sublime .Region (r .b - 1 , r .b )
282
- usym = self .view .substr (u )
283
- names = names_by_symbol (usym )
284
- if not names :
285
- self .view .replace (edit , u , code_by_symbol (usym ))
286
- else :
287
- self .view .replace (edit , u , u'\\ ' + names [0 ])
288
-
289
-
290
242
class UnicodeMathReplaceInView (sublime_plugin .TextCommand ):
291
243
def run (self , edit , replace_with = None , begin = None , end = None ):
292
244
if not replace_with :
0 commit comments