Jordan Lewis wrote:

> Bram Moolenaar wrote:
> > Jordan Lewis wrote:
> >>    * Undo persistence - save a representation of the tree to a file on
> >>      or before exit
> >>     
> >
> > This would be really nice.  But it's very likely too much work for the
> > SoC.  Especially because it must work very reliably.
> >   
> I have been thinking more about a possible implementation of this, and I 
> think that the main
> difficulty would be coming up with a text-based (or binary) 
> representation of the undo tree that is
> isomorphic to the undo tree data structure. Once that is overcome, 
> though, I don't think that
> the saving/loading functionality (which comes down to converting the 
> data structure into
> the file representation and back) would be too much work for me in the 
> 2+ months that
> SoC consists of. There are already some hints on how this might be done 
> in the other .viminfo
> data as far as I can tell, for example per-file mark history.
> 
> It sounds like you know about another difficulty that I am missing, 
> however, and I would
> greatly appreciate if you could explain what it is so I can revise my 
> proposal.

If you dump the internal undo tree into a file, and read it back later
when editing that file again, most of the things should work.

However, the work is in the details.  What if the original file was
changed?  At least this should be checked, since the undo tree relies on
the text not to change.  When it changed, does that mean you lose all
the undo info, it becomes useless?  Or can you somehow cleverly only
disable the changes in parts that were changed.  E.g., when text was
inserted somewhere in the file (very common when it was opened through
another application).  Could use checksums on blocks of text perhaps.

Also, where do you store the undo file?  Must not get in the way of the
original file, but sure to be found when opening it again.  More sure
than finding the swap file.

When reading back the undo file proper checks should make sure that the
information is valid.  Vim should not crash when the file has been
changed in some way.

There are probably a few more things I can't think of right now.

-- 
If Apple would build a car...
... it would be powered by the sun, be reliable, five times
as fast and twice as easy to drive; but would only run on
five percent of the roads.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui