TSE: How to possibly implement folding?

41 views
Skip to first unread message

knud van eeden

unread,
Sep 18, 2026, 9:53:29 AMSep 18
to SemWare TSE Pro Text Editor

zhong zhao

unread,
Sep 19, 2026, 9:02:02 PMSep 19
to SemWare TSE Pro text editor
My personal opinion is that code folding is a bad idea.

在2026年9月18日星期五 UTC+8 21:53:29<knud van eeden> 写道:

Knud van Eeden

unread,
Sep 20, 2026, 4:50:06 AMSep 20
to sem...@googlegroups.com
Yes, I would personally not use it either, but it is always nice to have I think.

I worked e.g. at IBM before and there they used of course Lotus Notes Databases
earlier, very popular. 

And its documentation in those Lotus Notes Databases had very much code folding.

My preference was always to expand it anyway, I like to see all the information if possible.

But in the past there were several users and including Semware actually that wished to
have folding available in TSE.

So here another attempt and another implementation to at least show the principles.

There were at least already 3 implementations (=.s programs) thus of folding.

Including one more (I believe, which would be nice to have) implementation of folding by Carlo Hogeveen, but I could not find that one on his website nor in my files here (or it was about wrapping, not sure).





--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/semware/fcdad3bf-ac30-40d1-b595-e8b2ed53b69cn%40googlegroups.com.

zhong zhao

unread,
Sep 20, 2026, 9:05:14 PMSep 20
to SemWare TSE Pro text editor
Those support code folding is not using compressed view.
If you use compressed view by hand, you must give up code folding.
Because code folding is a sub-function of compressed view, and compredded view is more more powerfully than  code folding.

knud van eeden

unread,
Sep 22, 2026, 8:29:19 PMSep 22
to SemWare TSE Pro text editor
> If you use compressed view by hand, you must give up code folding.

Giving up code folding is not obligatory necessary at all, after doing some more experimenting with the ideas of folding.

As workaround you simply 'Open All Folds' first, then all the text is visible again do the search and look at the compressed view.
Then after that close of the folds again, where applicable, that should be a doable manual action.


I see after more experimenting myself in TSE certainly many applications of the folding, the only intrusive thing
is that you have some extra characters in the file for the marking. No big deai, use e.g. the 
comment characters like '//', '#', 'REM', ... so that those markers are ignored by the programming language.


knud van eeden

unread,
Sep 24, 2026, 6:19:07 PMSep 24
to SemWare TSE Pro text editor
Note further FYIO that 'folding' is officially on the roadmap of Semware.
From the latest TSE version 4.50.30 read.me file:

Inline image


knud van eeden

unread,
Sep 25, 2026, 4:00:31 PMSep 25
to SemWare TSE Pro text editor
The creation result of the begin and end folding markers (using <CtrlShift F11>) depends on the file extension type, e.g. if C, C++, Java, Perl, ... then respectively .c, .cpp, .java, .pl, ...

It makes it a 'comment' line, so that such begin and end marker lines are ignored by the respective compilers.

It is now checked and implemented for about 40 computer languages.



This folding version, originally written by Marc Spruijt, is further pretty simple and easy to use and works good in my opinion.

zhong zhao

unread,
Sep 27, 2026, 9:19:07 PMSep 27
to SemWare TSE Pro text editor
Why I say "Code folding is a sub-function of compressed view, and compredded view is more more powerfully than  code folding." ?
Code folding is compressed view use Find("^{{    }|\t[~iefswcr /:,# \t\[\\\{\}\x22]}?{{extern \x22C\x22}?{ @virtual}?_|~@[A-Za-z:]\w|[@+\-*/%^&|~!<>, \t:~]@([~;]*[~;,/'\x22]$}|{ @{class}|{typedef}|{inline}|{enum} }|{[ \t]#[~,+|&:<(!=/*\x22#\\\{?]#::[~% (;:+|-]#([~.;+|-]*[~;,\x22>+<|*:-]$}","ixav") for c/c++,
and other func_expr_str for other language.
Code folding is essentially compressing display function declarations
However, the actual requirements for compressed display are not limited to function declarations, but also include functions such as opening/closing, initializing/de initializing, memory request release, database connection/disconnection, configuration data read/write, GUI message processing, lock operations, branches/loops, etc

zhong zhao

unread,
Sep 27, 2026, 9:28:10 PMSep 27
to SemWare TSE Pro text editor
If I were to make an appropriate metaphor to describe the relationship between code folding and compressed display, I think we could say, for example, polarized light technology and CT scanning technology.
(^_^)

Reply all
Reply to author
Forward
0 new messages