Neil Hodgson wrote:
> John Yeung:
>
>> The rule I'm looking for is "if the line ends in
>> a colon, indent the next one"
>
> You also need to consider lines that contain extra whitespace or
> comments before the line end.
Well, is it hard to have the autoindent logic ignore whitespace and
comments while finding the end of the line? That certainly would be
more accurate, though for me it's enough just to match the literal
newline character (because I tend to put comments on their own lines).
Actually, it would also be enough in my case to indent the next line if
and only if the cursor is immediately following a colon. I don't know
if this is any easier or harder to check than end-of-line.
Another nonindenting use of colons is the lambda form. I doubt this is
nearly as widespread as the slice, or the single-statement, same-line
block for that matter, but it must have its devotees.
> I'm sure a more accurate indenter can be implemented but there are
> quite a few cases to consider.
True. I would imagine for many programming languages, a perfectly
robust indenter would contain quite a significant subset of the
interpreter/compiler itself.
John
_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest