12-01-2022, 04:18 AM
I improved the code for #6, and now the cursor can be anywhere in the subfunction
Macro Macro6
Trigger Aq
Macro Macro6
Trigger Aq
out
int h=GetQmCodeEditor
int pos=SendMessage(h SCI.SCI_GETCURRENTPOS 0 0)
int lineN=SendMessage(h SCI.SCI_LINEFROMPOSITION pos 0) ;;out "行 %i" lineN
_s.getmacro
int i1; str s1
for _i lineN+1 0 -1
,str s_.getl(_s _i)
,if(s_.beg("#sub"))
,,i1=_i
,,s1=s_
,,break
out "Begin# in Line %i, string is %s" i1+1 s1
int i2; str s2
for _i i1+1 numlines(_s)
,s_.getl(_s _i)
,if(s_.beg("#sub"))
,,i2=_i
,,s2=s_
,,break
,else
,,str cf.addline(s_ -1)
out "End# in Line %i, string is %s" i2+1 s2
cf.rtrim; out cf