vim-mundo
vim-mundo copied to clipboard
Show history for selected lines
I don't know if it's even possible, but I would love to see some functionality that would allow me to see a tree for selected line(s). In your opinion, how hard would it be to implement this feature? I'd gladly help.
Great question - sort of like a git blame
? Would this be as simple as supporting visual selections (filter out all undos from mundo that have anything to do with the current selection)?
Yes, that's how I primarily imagined it. A lot of the times I find myself trying to see how the specific block of code has changed over the time and currently I just end up moving down the tree, looking for the changes that contain any lines from said block.
I don't this would be too hard:
- Support passing the selected line numbers to MundoRenderGraph()
- https://github.com/simnalamburt/vim-mundo/blob/master/autoload/mundo.py#L71
- Currently we're using python's builtin difflib library to generate the unified diffs...
- We'd need to determine which lines are affected in the undo (filter appropriately)
- As we process the undos, we'd need to keep a running line offset counter. For instance if one diff adds/removes X lines in front of the selected block we're interested in, we'd need to account for that as we go further on in the undo history.
I feel like parsing the unified diff output would be the easiest way to do these two things, but it might not be the most efficient.
@fuine unless you wanna take a crack at it, I'll give it a shot this week.
@dsummersl I could take on this issue, but not before the upcoming weekend. If you have a spare time however you could start hacking on that and I could help you. I'm not sure if that works for you but I'm pretty flexible in that regard
@fuine 👍 sounds good - I'll see what I can get done, you can take over or help code review. (or vice versa, if I completely drop the ball this week!)
Didn't get as much time as I wanted into this over the weekend, but I got a little. Wrote some more unit tests for graphlog, figured out where I think the changes could happen. I'll push up a branch when I get a little further along.
I'm sorry, looks like we have similar issues with time. If you have something written already please consider creating a WIP PR, as I might join in and hopefully help you.