vim-mundo icon indicating copy to clipboard operation
vim-mundo copied to clipboard

Show history for selected lines

Open fuine opened this issue 7 years ago • 8 comments

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.

fuine avatar May 13 '17 21:05 fuine

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)?

dsummersl avatar May 14 '17 13:05 dsummersl

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.

fuine avatar May 14 '17 13:05 fuine

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.

dsummersl avatar May 14 '17 14:05 dsummersl

@fuine unless you wanna take a crack at it, I'll give it a shot this week.

dsummersl avatar May 15 '17 15:05 dsummersl

@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 avatar May 15 '17 15:05 fuine

@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!)

dsummersl avatar May 15 '17 15:05 dsummersl

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.

dsummersl avatar May 23 '17 01:05 dsummersl

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.

fuine avatar May 24 '17 07:05 fuine