Page 1 of 1

Column indenting - Really great idea

Posted: Tue Aug 21, 2007 10:40 am
by Haro
I have a really great idea that i would really like TextPad to implement. The indent feature where you press down and it goes to the initially selected column is a great feature but i would like more. How about an indenting feature like MS Word, only the indenting works by column. That is, it moves the text on each line by one column (since the font is fixed width). Here is a pic (gif amination):
Image
It can be configured to move comments, identifyers, etc. So you can align all comments on each line.

Also, i like how it converts tabs to spaces, but i would like it if it deleted 4 spaces (i.e the tab width) when backspace is pressed, as long as there is 4 spaces before the cursor.

I would really like to see these ideas implemented, there is so much more that you can do with text editing (especially for code) so why don't editors do it? TextPad can be much more powerful yet still be simple and fast.

Posted: Wed Aug 22, 2007 7:55 pm
by mattrix
I'd like to be able to indent by spaces rather than just by tabs.

Posted: Wed Aug 22, 2007 11:59 pm
by Haro
That's what i'm talking about. Everything would be done in spaces (unless the user selected to use tabs). If you move the indenting thing on the ruler up the top then it just adds spaces to each line in between the previous non-whitespace character and the ruler position. If there is a whole word in between ("SomeObject" in my pic) then it won't split it up and move it.
Furthermore, you can choose what to move. If it's comments, then it only moves lines with // (or whatever the syntax is).
It's brilliant! No longer would i have to sit there pressing spacebar on every line!

Posted: Thu Aug 23, 2007 4:18 pm
by mattrix
The handling of tabs/spaces for indents is important, too.

Makefiles need tabs; Fortran77 needs spaces; most languages don't care.

I don't know if the // example you put in would be easy to implement. One thing that's nice to have is indents that honor block versus regular mode.... in block mode, you'd want to indent just the block you've selected.

Posted: Fri Aug 24, 2007 2:10 am
by Haro
mattrix wrote:One thing that's nice to have is indents that honor block versus regular mode.... in block mode, you'd want to indent just the block you've selected.
Yes that would be good too. In either mode it would only indent the selection (is any).
I don't know how you would implement such a thing, i think it wouldn't be too hard.

Code: Select all

when indent ruler moved:
for each line selected {   // or all lines
    if cursor is at '//' {
        add space (or tab);
    }
}
otherwise, it doesn't do anything. So only // gets moved. I'm not sure if it would be that easy, but i would hope that it would be doable