gillyb / stable-windows

Keeps vim windows stable on layout changes
40 stars 1 forks source link

Reset cursor to original position after preview closes. #3

Open iago-lito opened 4 years ago

iago-lito commented 4 years ago

Hello, and thank you for this plugin :)

I understand that the cursor needs to move when the preview window would override it. However, I often need to navigate back to the original position by myself when the preview window is eventually closed.

Would it be possible for the cursor, when the preview window is closed, to optionally/automatically navigate back where it was just before the preview opened?

Note, as a workaround, that a couple of <c-o> is enough to navigate back to original location (btw why 2?).

This is it, thank you for support :)

gillyb commented 4 years ago

I made a small change regarding preview windows (after the other issue you opened) - so if you can let me know if this still happens that would be great. Thanks! :)

iago-lito commented 4 years ago

Hm, still bugging after a :PlugUpdate or a fresh install. It works fine at the top of the file with small previews, but weird navigation occur if the cursor is further down or if the preview window is tall. I'll try to build a small animation to help you understand what is happening here.

BTW I use coc's doHover action to test your changes, but doubt this is minimal. How can I simply check your pluggin with no additional packages?

Anyway, happy 2020 to stable-windows :)

iago-lito commented 4 years ago

I've just found out about asciinema :D Does this help?

gillyb commented 4 years ago

Hmmm, I see exactly what you mean now, thanks for the video (without it I probably still wouldn't understand). I need to think a little about how to implement a clean solution for this problem. I'll try to get to it during this week, or next.

ds2606 commented 3 years ago

this was still an issue for me in opening/closing the preview window with external plugins (e.g. the hover command in ALE) - I resolved it in an easy but kind of hacky way by automatically setting and triggering marks if anyone needs a quick fix

giddie commented 3 years ago

This also seems to cause some nasty bugs with deoplete. This actually results in text getting messed up, which is a real showstopper:

https://asciinema.org/a/kF0QcjiuGmJXE9Av5dgs59kNc

Edit: I've opted to use https://github.com/ncm2/float-preview.nvim to solve my usecase.