debugloop / telescope-undo.nvim

A telescope extension to view and search your undo tree 🌴
MIT License
627 stars 11 forks source link

Toggle between diff preview and the actual state preview #46

Open pksunkara opened 6 months ago

pksunkara commented 6 months ago

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:

pksunkara commented 5 months ago

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.

debugloop commented 4 months ago

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?

pksunkara commented 4 months ago

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

debugloop commented 2 months ago

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?

pksunkara commented 5 days ago

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.