indent style for D

Stewart Gordon smjg_1998 at yahoo.com
Sun Jan 29 09:21:46 PST 2012


On 29/01/2012 15:39, David wrote:
> Am 29.01.2012 16:23, schrieb Trass3r:
>> But people are dumb and many project leaders "take no risks" and require
>> spaces everywhere instead of doing it properly.
>>
>> An ever better solution is elastic tabstops, but unfortunately no major
>> editor supports that.
>
> Where's the problem, you can configure most editors to insert N-spaces when pressing the
> tab-key. Some editors are so smart enough to handle the N-spaces still as tabs but save
> them as spaces.

Some editors (Notepad++ included), when configured to do tabs as spaces, only insert _new_ 
tabs as spaces and leave existing tabs as they are.  And when configured do to tabs as 
tabs, leave existing space indentation alone.  And sometimes even more annoyingly, convert 
spaces to tabs when you block indent/outdent or start a new line.  This leads to files 
that multiple people have worked on being indented with a mishmash of tabs and spaces.

Much better would be to:
- Preserve the sequence of spaces and tabs when you block indent/outdent
- When you insert a line break, copy the sequence of spaces and tabs onto the new line
- When you type a tab preceded by only tabs, insert a tab
- When you type a tab preceded by characters other than tabs, insert spaces
- Attempt to detect the indentation style when opening a file and then follow it
- Provide commands to convert tabs to/from spaces separately from block indent/outdent

Stewart.


More information about the Digitalmars-d mailing list