rmagatti / goto-preview

A small Neovim plugin for previewing definitions using floating windows.
Apache License 2.0
835 stars 27 forks source link

[BUG] Current buffer closes with preview if the preview and parent buffer are the same file #66

Closed MJB47 closed 2 years ago

MJB47 commented 2 years ago

Describe the bug If I preview the definition of something that is defined in the same file, and then close the preview, and then navigate to another buffer, the original buffer I was editing closes and no longer shows up in :ls

All key mappings are assuming the defaults.

To Reproduce Steps to reproduce the behaviour: In a file that both defines a new object and refers to that defined object:

  1. With the cursor over the referrer, preview the definition with gpd
  2. Close the preview with gP 2a. Note at this stage that :ls still shows the parent buffer.
  3. Navigate away from the current buffer with :bn (or any other way you like)
  4. :ls no longer shows the buffer, :bp and <C-^> cant return to it, the latter displaying "E23: No alternate file`

Expected behavior The buffer I was editing/previewing from would still exist and be navigable to with <C-^>.

Baseline (please complete the following information):

rmagatti commented 2 years ago

Hey @MJB47 thanks for the issue submission. This line is likely the culprit. https://github.com/rmagatti/goto-preview/blob/37116fb5167d2a93cada8db9135c5032a25348a7/lua/goto-preview/lib.lua#L130

It's setting bufhidden to wipe for the buffer. So when you leave it it wipes that buffer from the buffer list.

I'll have to think about how to solve this

MJB47 commented 2 years ago

closed with the merging of the above