IndentMatch v1

12 views
Skip to first unread message

Carlo Hogeveen

unread,
Dec 25, 2025, 11:03:35 AM (4 days ago) Dec 25
to sem...@googlegroups.com

https://ecarlo.nl/tse/ToolsAndExtensions.html#IndentMatch

Visually move the cursor to the next/previous line with the same indentation.

Seeing the text move visually retains understanding it.
The cursor speed is configurable.
<Escape> interrupts the moving cursor.

Note that this tool does not know a programming language's syntax.
It only finds matching opening and closing syntax if they have the same indentation.

The idea for this tool came from the popular GuideLines extension.
If we like manually finding a matching indentation using visual guide lines,
why not also be able to do so automatically?

Tip:
There is also my IndentView tool,
https://ecarlo.nl/tse/ToolsAndExtensions.html#IndentView
which provides an alternative way to find and understand matching indentations.

Carlo



zhong zhao

unread,
Dec 25, 2025, 8:01:30 PM (3 days ago) Dec 25
to SemWare TSE Pro text editor
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()

Claus Futtrup

unread,
Dec 26, 2025, 5:32:14 AM (3 days ago) Dec 26
to sem...@googlegroups.com
Hi Carlo

It sounds cool. :-)

I have been a long user of TSE finding matching brackets (delimiters).
With more extensive programming in Python, which uses indentation
instead, this sounds like it will become a handy feature.

With kind regards,
Claus
Reply all
Reply to author
Forward
0 new messages