[scintilla] Re: comments inside blocks

Neil Hodgson nhodgson at bigpond.net.au
Fri Jan 3 06:30:03 EST 2003


[Pádraig (not using leading '>' for example as that messes up cutting and
pasting the code]
----------------------------------------
for i in range(10):
     print i
#comment nothing to do with for

for i in range(10):
     print i
#not normal but valid comment in for
     print i**2

----------------------------------------

> I noticed no changes wrt the above.

   In 1.49, the fold point on line 1 folds away lines 2..4 and in the test
version it folds away only line 2. The fold point on line 5 behaves the same
under both versions.

> Hmm I noticed another minor issue wrt brackets, ie: {([
> the following isn't folded:
>
> t=(
> 1,
> 2,
> 3
> )

   Python folding structure is mostly based on indentation with optional
extra folds for indented comment blocks and triple quoted strings and with
minor fiddles to make non structural lines (comments and spaces) fold
sensibly.

   Looks like the optional extra folds for comment blocks are no longer
working. Hey, [Bruce Dodson, Stephan R.A. Deibel, John Ehresman], are you
interested in fixing this - I think the dissociation of header comments is
wanted enough to allow it to break comment block folding, but it would be
good if they could both be on at once or if not that there could be an
option to choose between them.

[Peter Hansen]
----------------------------------------
for i in range(10):
    print i

# if we make it to the end, do this
else:
    print 'loop completed normally!'

----------------------------------------

[Pádraig]
> well the else (same level) is never folded along with the for

   Scintilla treats the 'for' and 'else' both as level 0 lines because they
start in column 0. There could be an option to treat lines that start with
certain keywords (else, except, ...) as slightly more indented (say, half a
column) than they are.

   Neil






More information about the Python-list mailing list