Many times, I write a bunch of code before realising that a lot of it (but not all of it) is incorrect. At this point, being able to switch between two different points of history and selectively copy-paste the stuff that was correct is a godsend.
This is especially useful if you undid some operations, typed a little and then realised that you forgot to copy some important stuff that was strewn around in the old version.
That's one reason why I implemented it so it wouldn't lose information.
Hmm. I plan to implement a diff. The way I have it, you could copy the current source, hit undo to a version you want to compare again than use the clipboard as the version to diff with (vscode calls this "Compare Active File with Clipboard".) If you mess up you can still hit undo to go through all the previous edits you made since it's not lossy. Would this be as good for your usecase?
A tree is essentially a nice GUI on top of what you already have. It's allows me to visually click (or navigate) to a specific point of history, instead of remembering to hit Undo 15 times.
AFAIU, it also allows you to redo, even if you accidentally added a letter after undoing. That accidental edit then adds a branch to the tree instead of replacing all the redo entries.
Just a thought, do you want it as a tree? It seems like it'd make more sense if there was a bar or key you can press to go back and forward to the changes you want. I didn't really understand why having it as a tree was helpful.
I'm not going to say I wont implement it, I'm just saying I'm not understanding why you want it that specific way. Is the change you want always many minutes apart and why you want it as a tree? To find the one that happened many minutes before another? I know some people like how vscode has a timeline that says how many minutes/hours ago a change was, so they can pick it out
I type "A B C D".
Then I undo thrice to get "A".
Then I type to get "A E".
And now I realise that what I actually want is "A E B D".
My edits have created a branch is history. And I need to switch to the old branch and copy stuff twice (first "B" then "D"). That is why a tree is important.
I didn't heavily use undo trees so I don't remember how neovim/emacs displays it. I think I get it enough that if I try it out I'll be able to understand what you mean
This is especially useful if you undid some operations, typed a little and then realised that you forgot to copy some important stuff that was strewn around in the old version.