As a software developer, I used a lot of text editors in the years I’ve been using computers, and they basically fall into two categories:
- Simple text editors – which are good for the occasional text editing task and are basically a simple word processor replacement and often do not offer much more then a simple search and replace function and the ability to change the font face used for the text (see MS Windows Notepad)
- Developer editors – which are a different beast all together and are packed with features for advanced text editing (One of my favorite developer editor is EditPlus for MS Windows, which I even use occasionally now that I don’t use MS Windows at all)
The second category is definitely the more interesting one and the state of the art in this category has developed in leaps and bounds in the last few years, mostly fueled by intense competition in the IDE market since Eclipse was released. One of the neatest features that modern developer editors offer is code folding(1), which is the ability to collapse whole sections of text that are a single logical unit (for example – a class or a function in a program code) and replace it with a single short line of text. When editing many large files at the same time, hiding complex code sections, that you are not working on right now, behind simple representations is as powerful concept for text editing as variables are for programming.
A couple of days ago I stumbled upon a nice spin on the idea of code folding – Adobe Flash Professional has a text editor used to edit ActionScript code sections embedded in Flash objects, and that simple editor offers a neat trick:
Arbitrary text folding:
You can simply select any text in the editor and collapse that. The Adobe ActionScript editor does not offer traditional code folding – which is more useful, in my humble opinion, because it automatically selects meaningful collapse ranges for you based on the type of code you are editing – but selection folding is a neat feature and almost makes up for not being able to fold code blocks.
(It does have some problems though, for example you can “fold” a few chars selected on a single line in which case it looks really ridiculous, but nothing a good imitation implementation can’t fix)
- I can even go as far as to say that if a text editor has no support for code folding, then its not a developer editor [↩]