AndrewRadev/undoquit.vim

Does not appear to restore to the proper tab window.

Closed this issue · 9 comments

If you have multiple tabs open, it seems this does not restore to the correct tab.

You're right, I've noticed it as well, but never sat down to fix it properly.

I've pushed a fix to master, could you check it out and see if it works for you now?

I think the fix is definitely an improvement. I notice it sometimes restores a split into the incorrect location of a tab - but hey, this is still better than anything that exists for Vim right now, so thank you!

I seem to recall occasions like that, too, but never managed to replicate them. If you happen to figure out a repeatable case in which it happens, do let me know.

Sure.

I have a current repro:

  • Open three tabs.
  • In the last tab, do :NERDTree.
  • Edit a file next to the nerd tree.
  • Quit editing that file.
  • Then "undo quit"

It clobbers the current tab, it should open a new one.

BTW: I've featured undoquit in VimBox: https://github.com/jordwalke/VimBox

Hmm, I'm not sure if I can reproduce. After I open the NERDTree, and then edit a file from it (leaving the NERDTree open) and then quit the file (leaving the NERDTree open) and then :Undoquit, it restores the buffer in the entire tab, removing the NERDTree. Is this the problem?

However, in this case, I don't think it should open a new tab, it should probably still :edit the file and find a way to keep the NERDTree open. Or do you see some other behaviour (maybe due to NERDTree settings)?

BTW: I've featured undoquit in VimBox: https://github.com/jordwalke/VimBox

Thanks :).

I'll be more clear in the repro steps:

  • Open three tabs.
  • In the last tab, do :NERDTree.
  • Edit a file next to the nerd tree.
  • Quit editing that file.
  • Quit that nerd tree instance. (It takes you back to the previous tab).
  • Then "undo quit"
  • It destroys the current tab, when it should open the next one.

That explains it. If you don't quit the nerdtree buffer, it should still open it in the same, but closing the nerd tree means closing the tab...

This was kind of tricky, but I've pushed a commit that might fix it. There's still some handling of hidden buffers that I'm not happy with, but I'm hoping it won't be a problem in practice.

Could you try it out and let me know how it behaves?

I'm hoping this fixed the issue, so I'll go ahead and close this.