telescope-undo.nvim icon indicating copy to clipboard operation
telescope-undo.nvim copied to clipboard

Toggle between diff preview and the actual state preview

Open pksunkara opened this issue 1 year ago • 5 comments
trafficstars

In the plugin https://github.com/jiaoshijie/undotree, I like how they show the actual state instead of diff. I would love to have the same here. I would want the following:

  • A configuration option that lets us select either the diff or the state
  • Additionally a toggle that switches between diff and the state.

pksunkara avatar Mar 23 '24 23:03 pksunkara

Forgot to mention, really appreciate the plugin. I am going to spend a bit of time later this week to figure out how we can better the experience when taking #40 into view and make sure this is the best plugin out there for this capability.

pksunkara avatar Mar 26 '24 09:03 pksunkara

I though about that for a bit, how would we make this truly useful? By default, that would just preview the same imports and stuff for each state, making this kinda useless especially on longer files, no?

If I grabbed a (first? last?) line number of change from the diff and scrolled there, what about if there are many changes? What does that other plugin do?

debugloop avatar May 01 '24 11:05 debugloop

I think there's some miscommunication. What I meant is to toggle between the diff and actual full content (current file - diff).

pksunkara avatar May 01 '24 13:05 pksunkara

I don't think there is. So assume you can toggle this now, do you think a view of the actual undo state's buffer contents starting at line 0 would be useful?

I personally don't think it would be, it's bound to be just some headers/imports/whatever visible on the previewer. So: If I scroll that preview somewhere else, where should it be? The location of the change in comparison to what? What if the change is very large (i.e. spans many lines), do I go to the first line affected? The last? The average of them, with might mean there is no changed content?

There's some thought to be put into this if I'm to cook this up, but I don't actually see how this should look like myself. In my mind, users open up this telescope and will either:

  1. Browse the tree until some 1-10 states upward to restore a diverged undo state.
  2. Start typing something from their head "I had this earlier but deleted it", find it and yank it.

What's the scenario where a view of a state's very first few lines helps?

debugloop avatar Jun 30 '24 14:06 debugloop

Sorry for the late reply.

I personally don't think it would be, it's bound to be just some headers/imports/whatever visible on the previewer. So: If I scroll that preview somewhere else, where should it be? The location of the change in comparison to what? What if the change is very large (i.e. spans many lines), do I go to the first line affected? The last? The average of them, with might mean there is no changed content?

Since the whole file is scrollable, it doesn't matter if the first line is shown, right? But maybe the location of the change that resulted in that state would be better.

I think some just want to see the change in context before yanking it.

pksunkara avatar Sep 15 '24 19:09 pksunkara