i got a statement from neil on the state of folding remembrance in scintilla and wanted to share:
There is code in SciTE in the FoldState class in scite/src/SciTEBase.h for storing folding of buffers that aren't shown. There is also code in scite/src/SciTEBuffers.cxx for saving and loading this from file: search for "session.folds". SciTE only allows a single view on a file.
Neil
wont be looking into this for the next 3 weeks, but thanks to everyone for laying out the roadmap :) - matt
On 9/21/09, Thomas Martitiz s0523936@htw-berlin.de wrote:
Am 18.09.2009 14:17, schrieb Lex Trotman:
Hi,
Another 1.5c. It was more fun to think about this than what I'm supposed to be doing, especially as g++ just gave me a 75 line error message (and all it wanted to say was I had an extra const that I shouldn't have)
From past experience in another system, I think the problems that Neil is worried about are that folds are on a per line basis (confirmed by looking at the interface), but of course any saved fold data is garbage if the lines in the file have changed.
As Neil points out thats hard enough when only worrying about in-memory views, its really difficult to ensure when relating saved fold lines to an external file. You must ensure that the file hasn't changed in a way that invalidates the fold data.
The fold data therefore needs to save a suitable signature of the file to decide on its validity, I guess mtime is the minimum
This breaks on just resaving/touching the file.
or some MD5 or SHA signature on the contents.
That means external dependencies.
Really, the easiest and simplest way I see is to store the line number if the folding mark and the content line. Then iterate through all line numbers, and strcmp() the content with the dumped one. If it doesn't match -> don't fold. That sounds pretty save to me-
And there needs to be a way of finding the fold data for a particular file, maybe same pathname with an added extension would do, (eg /home/fred/fred.cpp.fd~ ,the ~ so it would be ignored by VCS). That is if you don't mind such files littering your src directories. If its not in the same directory it gets a little bit harder still.
I think a single file would be most easy to handle.
Geany mailing list Geany@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany