Page 1 of 1

Elastic Tabstops (end of spacing wars)

Posted: Sat Nov 21, 2009 10:04 pm
by qkz73
This lovely idea would be absolutely wonderful. It is not mine, but there is a link below. True tabstops for code, to align a line's elements into multiple "columns". I'd love to have an option to have TextPad load a file and display it like the example box does on the page at the url below!
http://nickgravgaard.com/elastictabstops/

An example in PHP of the type of code for which this would be extremely useful:

Code: Select all

class Example {

    // note the way that the variables line up here, and the values, and the comments
    // the idea is to NOT need physical spaces, 
    // but just one tab char and then have the TextPad software implement an elastic stop (see the url)
    protected   $myname   = "whatever";    // comment
    protected   $data     = null;          // comment
    public      $id       = 0;             // comment

    function __construct() {

        // again, note the way the key, value, and comment all line up here
        $this->data = array(
            'key'               => "long string",   // comment
            'longerkeyname'     => "str",           // comment
        );

    }
}
[/size]

This idea does require some thought and research, but I know it can be done, because the author of that url has figured out at least one viable approach. If made configurable enough, this could be useful for ALL programming languages (at least the dozen+ that I know), not just PHP or Perl or Javascript or web stuff, but Python, WSH, etc. Some other settings that TextPad would need do come to mind, like a minimum width, and perhaps a maximum number of tab chars to process as elastic stops.

One of my main reasons is that I'm one who loves to code using Verdana. For some projects, though, working with other coders who use a monospace font and align things such as below, this requires hitting the right number of spaces or tabs. So, we spend all this time hitting space and tab instead of just writing coding. Aren't we paid more than enough to focus not on byte beautification, but actual processing logic? It would be very very nice.

similar idea

Posted: Sun Nov 22, 2009 12:09 am
by qkz73
Column Indenting (very nice animation)
http://forums.textpad.com/viewtopic.php?t=10222

Sorry to spam. Hadn't noticed that idea before. Very similar in concept. I think actually, you need this idea of elastic tabstops first, and then that one could be implemented.. a UI to adjust where the elastics tabs do stop.