Stefan Küng:
> I'd like to request a feature:
> Handle the WM_SETREDRAW message.
>
> This message is implemented by most windows controls: when set to FALSE, the control isn't updated. Only when set back to TRUE, the control updates its UI.
How do you see this being implemented? I could imagine the window appearing inconsistent if a paint occurs when redraw is set off.
> When I load a file into Scintilla, I'm reading chunks of data (4kbytes) and add them to Scintilla using SCI_APPENDTEXT. Of course I first call SCI_ALLOCATE with the full file size.
Why such a small buffer? SciTE uses 128K.
> Now, for every call to SCI_APPENDTEXT, Scintilla does a lot of work. It does not just insert the text but also updates the styling (sometimes at least),
It shouldn’t update styling unless you are handling an event during loading.
> but it always updates the scroll bars. Even if the window is not visible! And that slows down loading big files quite a lot.
An alternate is ILoader (SCI_CREATELOADER) as used by SciTE for loading in a background thread.
Can't you achieve what you want by setting a variable ie: SCI_NoDraw = 1 then subclassing the Scintilla window and returning true on the WM_DRAW/WM_PAINT messages if SCI_NoDraw = 0?
Stefan Küng:
> Also, how that message is usually used is by first turning redraw off, then fill the control with data or do lots of other stuff with it, then turn redrawing back on.
How would the scroll bars be stopped from drawing? They are integrated in the window, not separate windows.
> But the feature request still stands: I know of another few features that would benefit from this.
Its not something that I want to work on now so it would have to be contributed by someone.
> For example we have a function to sort lines in the editor. Preventing Scintilla from doing any updates while we write back the sorted lines would also benefit from this. Or when we change all tabs to spaces in a huge document. Or …
Changing tabs to spaces or similar in SciTE over a large document doesn’t cause display flashing. Is your application changing the selection when making each modification?
Stefan Küng:
> Yes, but if you don't call SetScrollInfo(), they're not redrawn or recalculated.
Then you have a scroll state that is not synchronised with Scintilla’s state. For example, the vertical scroll bar may have more lines than are in Scintilla. That seems like a situation that could lead to bugs.
> ok, maybe the tabs/spaces example wasn't the best. But the line sorting really is affected:
> the lines are first removed, then inserted again one-by-one in the sorted order.
Why insert line-by-line? Just replace the whole range in one call.