p.setDirty()
<< do the move >>
p.setDirty()
--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/2874489c-defe-4bdf-90a9-b2c6639858ef%40googlegroups.com.
If I'm understanding correctly, with your planned changes if a user opens a leo file and makes a few changes and then undoes all the changes and tries to close the file, then the user will be prompted about saving changes even though the outline matches everything on disk. Is that correct?
That behavior doesn't seem to be the most user friendly. Better that than having the bug where changes are lost, but I wonder if there is a way to have both without it being too complicated?
Just thinking out loud, but maybe it would work to have a dirty counters for the nodes. After a save, all the dirty counters are reset to zero. Undo operations decrement the dirty counter for affected nodes and redo operations increment the counter. Any time a given node's counter is at zero, the dirty bit is cleared and any time the counter is non-zero, the bit is lit.
On Sun, Dec 15, 2019 at 7:59 AM Brian Theado <brian....@gmail.com> wrote:
That behavior doesn't seem to be the most user friendly. Better that than having the bug where changes are lost, but I wonder if there is a way to have both without it being too complicated?This is actually a completely different issue :-) #1451 involves making sure that all external files are written, which devolves into making sure that all @<file> nodes are marked dirty when they need to be.
The behavior you mention involves making sure that the user is given the opportunity to save external files (and the outline itself) when they try to close the outline. Leo's behavior is standard in this regard, with the proviso that change may "cancel" so that no change is actually made. It would be possible to do a trial write to see if there were any change, but that's a nit, and it would substantially complicate the code. Imo, it's not worth doing.
Just thinking out loud, but maybe it would work to have a dirty counters for the nodes. After a save, all the dirty counters are reset to zero. Undo operations decrement the dirty counter for affected nodes and redo operations increment the counter. Any time a given node's counter is at zero, the dirty bit is cleared and any time the counter is non-zero, the bit is lit.There have been proposals for per-node undo, and this is similar. After congratulating myself on eliminating evil undo-related state, I am in no mood to add any new caching. The total advantage of such a scheme, in the entire projected history of the universe, does not begin to compare with the pain that any bug in such a scheme would cause.