Skip to content

Commit 8b1cc55

Browse files
author
DisposaBoy
committed
- allow passing the window to active_valid_go_view
- add new helper function rowcol to get the row/col of the cursor
1 parent fbeaa30 commit 8b1cc55

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

gscommon.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,14 @@ def notice(domain, txt):
8282
def is_go_source_view(view):
8383
return view.score_selector(view.sel()[0].begin(), 'source.go') > 0
8484

85-
def active_valid_go_view():
86-
win = sublime.active_window()
85+
def active_valid_go_view(win=None):
86+
if not win:
87+
win = sublime.active_window()
8788
if win:
8889
view = win.active_view()
8990
if view and view.file_name() and is_go_source_view(view):
9091
return view
91-
return None
92+
return None
93+
94+
def rowcol(view):
95+
return view.rowcol(view.sel()[0].begin())

0 commit comments

Comments
 (0)