Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#435 The ideal notification of a change in fLines

open
nobody
Core (49)
5
2012-04-02
2012-04-02
orwelldevcpp
No

This is not explicitly a bug report, but as a guy called SynEdit says:

Best Way To Get Help
SynEdit says the best way to get help with its software is by creating a new item in the Bugs Tracker.

... I'll report my problems here.

Currently I'm working on a branch of the last non-Unicode version of SynEdit for this project: http://orwellengine.blogspot.com/

As you can probably see, it's got working code folding, integrated into SynEdit, based on the incomplete work of Mystix. But I'm having trouble getting reliable notifications of a Line change to trigger fold scanning. One might think listening to OnChanged would do the trick, but, for example, when adding a newline, it fires before the actual newline is added to fLines. There are some more alternatives, each with their own drawbacks:

- OnChanged (even though it's in Past Tense) fires before Lines is updated.
- OnChange fires even earlier.
- OnInserted fire twice for every line added. Might be related to \r\n, but it isn't really adding two *lines*.
- OnDeleted fires too early: before Lines is updated.
- OnPutted fires for every character added. Works just fine.
- All messages fire way too often when loading files. I need one that fires after procedure TSynEditStringList.LoadFromStream is done.
(- I could add some hacky notify to Lines.EndUpdate.)

Currently, fold scanning is triggered by *OnPutted* (detects inline modifications) and *LinesDeleted/LinesInserted* (detect line count changes). I can't call it anything else than spamming, because each file loaded gets scanned numlines times and line removal/addition triggers scanning twice (Putted for \r\n and one of the other two).

So, all in all, is there a way to reliably receive notifications about line changes without spamming?

Note: are you guys interested in the code folding fork I'm currently using?

Discussion