[Geany] remembering folding status

Thomas Martitiz s0523936 at xxxxx
Mon Sep 21 19:15:51 UTC 2009


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.






More information about the Users mailing list