I use this to match the next/previous line with the same indentation:
//UpDownToDiff.s
proc UpToDiff()
integer cc1,cc2,cp1,cp2,n
n=0
cp1=CurrChar()
if cp1<0 cp1=32 endif
cp2=CurrChar(CurrPos()+1)
if cp2<0 cp2=32 endif
while (1) //Up to diff
if not Up() break endif
cc1=CurrChar()
if cc1<0 cc1=32 endif
cc2=CurrChar(CurrPos()+1)
if cc2<0 cc2=32 endif
if cc1<>cp1 or cc2<>cp2 break endif
n=n+1
if (n mod 5000)==0 Message(n) endif
endwhile
if CurrRow()<=3 ScrollToCenter() endif
UpdateDisplay(_STATUSLINE_REFRESH_)
end
proc DownToDiff()
integer cc1,cc2,cp1,cp2,n
n=0
cp1=CurrChar()
if cp1<0 cp1=32 endif
cp2=CurrChar(CurrPos()+1)
if cp2<0 cp2=32 endif
while (1) //Down to diff
if not Down() break endif
cc1=CurrChar()
if cc1<0 cc1=32 endif
cc2=CurrChar(CurrPos()+1)
if cc2<0 cc2=32 endif
if cc1<>cp1 or cc2<>cp2 break endif
n=n+1
if (n mod 5000)==0 Message(n) endif
endwhile
if CurrRow()>=Query(WindowRows)-3 ScrollToCenter() endif
UpdateDisplay(_STATUSLINE_REFRESH_)
end
//...
<Ctrl CursorUp> UpToDiff()
<Ctrl CursorDown> DownToDiff()