forked from maul-esel/FormsFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJumpToFunction.ahk
89 lines (36 loc) · 838 Bytes
/
JumpToFunction.ahk
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
_()
GetLine(Func){
ifEqual, Func, , return
WinGetTitle, title, EditPlus
if !Editor_FileNameFromTitle(title, fn)
return
return FindFunction(fn, Func)
}
~^G::
line := GetLine(Clipboard)
if !line
return
Send, %line%{ENTER}
return
Editor_FileNameFromTitle(Title, ByRef Fn){
j := RegExMatch(Title, "EditPlus.+\- \[(.+)\]", match)
ifEqual, j, 0, return false
Fn := match1
if SubStr(Fn,0) = "*"
Fn := SubStr(Fn, 1, -2)
return, true
}
FindFunction(Fn, Function)
{
FileRead, txt, %Fn%
re = `aiS)%Function%\([^)]*\)(\s|\n)*{
j := RegExMatch(txt, re)
ifEqual, j, 0, return 0
len := -2
loop, parse, txt,`n
{
len += StrLen(A_LoopField) + 1
if (len > j)
return A_Index
}
}