Andreas Rossberg wrote:
The most flexible but safe solution is to simply define the indentation as the sequence of indentation characters used. Two consecutive lines are indented consistently whenever one indentation is a prefix of the other. Hence you may freely mix different indentation characters, but you must be consistent across lines. Any decent editor should be able to ensure that.
Well no they won't, because some editors might replace blocks of 8 spaces at the start of a line with TABs (or something like that), meaning that 8 and 7 spaces would go to "\t" and " ", which your algorithm would reject.
If the editor does the replacement consistently everywhere (like I would expect) then it would not change the meaning of a "well-indented" program.
Yeah, but it probably won't. More likely, it will only perform the replacement on the lines which you actually edit, and leave the rest of them alone. -- Glynn Clements <glynn.clements@virgin.net>