ActiveState Community

Fold flags problem

Posted by Joker on 2008-05-20 03:37
OS: All / Any

If the file has just opened

var scimoz = ko.views.manager.currentView.scimoz
for (var line=0; line < scimoz.lineCount; line++)
    print(scimoz.getFoldLevel(line).toString(2) + '  '+ (line+1))

Out:
100000000000000010000000000 1
100000000000000010000000000 2
...
100000001000000010000000100 72
100000001000000010000000100 73
10000000000 74
10000000000 75
...
10000000000 497
10000000000 498

var scimoz = ko.views.manager.currentView.scimoz
for (var line=0; line < scimoz.lineCount; line++)
    print(scimoz.getFoldLevel(line).toString(2) + '  '+ (line+1))

Out:
100000000000000010000000000 1
100000000000000010000000000 2
...
100000001000000010000000100 72
100000001000000010000000100 73
10000000000 74
10000000000 75
...
10000000000 497
10000000000 498

but if you scroll to the end of file, all flags are activated

100000000000000010000000000 1
100000000000000010000000000 2
...
100000000000001010000000000 497
100000000000001010000000000 498
100000000000000010000000000 1
100000000000000010000000000 2
...
100000000000001010000000000 497
100000000000001010000000000 498

how to activate all flags at once, without scrolling?

ericp | Tue, 2008-05-20 10:08

The fold flags are calculated by scintilla's
colouriser [sic, non-American spelling] on an
on-demand basis, usually limited to the visible
portion of the file. You need to force it to
process the entire file's contents.

Insert this line at the start of the macro:

scimoz.colourise(0, scimoz.length);
scimoz.colourise(0, scimoz.length);

- Eric

Joker | Mon, 2008-05-26 13:49

Thank you for helping.