-
Notifications
You must be signed in to change notification settings - Fork 1
/
commands.py
66 lines (52 loc) · 2.03 KB
/
commands.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import sublime_plugin
from SearchPanelEnhanced.search_panel import get_panel
class DisplaySearchPanelEnhanced(sublime_plugin.TextCommand):
def run(self, edit, type = 'default', case_sensetive = True, backward = False):
get_panel(self.view, type, case_sensetive, backward).show()
class GotoNextSearchPanelEnhancedResult(sublime_plugin.TextCommand):
def run(self, edit, backward = False):
panel = get_panel()
if panel.panel == None or panel.panel.id() != self.view.id():
panel.set_view(self.view)
panel.next(backward)
class SearchPanelEnhancedComplete(sublime_plugin.TextCommand):
def run(self, edit, select = False, end = False):
panel = get_panel()
panel.done(None, select, end, False)
panel.close()
class SetSearchEnhancedOptions(sublime_plugin.TextCommand):
def run(self, edit, type = None, case_sensetive = None, backward = False):
panel = get_panel()
panel.toggle_options(type, case_sensetive, backward)
panel.change()
class SearchPanelEnhancedFindUnder(sublime_plugin.TextCommand):
def run(self, edit, backward = False, next = False):
if len(self.view.sel()) == 0:
return
panel = get_panel(self.view)
if next:
panel.next(backward)
else:
panel.set_options('default')
word = self.view.sel()[0]
if word.empty():
word = self.view.word(word.b)
panel.change(self.view.substr(word), backward)
class SearchPanelEnhancedSelectAll(sublime_plugin.TextCommand):
def run(self, edit):
panel = get_panel()
panel.select_all()
panel.close()
class SearchPanelEnhancedGotoHistory(sublime_plugin.TextCommand):
def run(self, edit, backward = True):
panel = get_panel()
panel.goto_history(backward)
class SearchPanelEnhancedSelectToFound(sublime_plugin.TextCommand):
def run(self, edit):
panel = get_panel()
panel.select_to_found()
class SearchPanelEnhancedDeleteToFound(sublime_plugin.TextCommand):
def run(self, edit):
panel = get_panel()
panel.select_to_found()
panel.get_view().run_command('delete_selection')