carbon-steel / detour.nvim

Use popup windows to navigate files/buffer and to contain shells/TUIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quitting float after splitting closes split too

Arkoprabho opened this issue · comments

First of all.. Love the idea and the plugin. Will try to make it my daily driver. It's going to ease the development flow a lot, especially when working with libraries

Here's my issue.

  1. Use :Detour to open a float on a method.
  2. Use <C-w>s to open it in a split.
  3. Navigate to the detour split, close detour float, closes the previously opened split too

Expected behaviour: Split should remain open when the Detour float is closed.

With tabs, it is working as expected.

Hi, thanks for trying my plugin and thanks for opening the issue. Now, if I understand correctly, when you are closing the detour float, it also closes the split window that you created from the float?

When I've done this in the past, the split would remain open. Here is the gif demonstrating this from the README.md:

Maybe for some reason, when you are closing the detour float, it's also deleting the buffer contained in the float (ie, it's calling :bdelete)? If that's happening it would explain why the split disappears too. I may be off the mark here, but it's my best guess at the moment. I just tried the behavior again on my neovim and it works as expected (ie, the split stays open when the detour float closes).

Does this issue happen consistently for you? Do you think there are any autocmds or plugins that might be causing the issue? Any other details you may have would be appreciated. Maybe you could try to recreate the issue from a minimal neovim setup with no configs except one to install the plugin?

This is a pretty serious issue if the problem is with the plugin so I'd appreciate any more info that you could share.

Howard you closing the popup? If I use <C-w>c it closes the split also

If I use <C-w>c it closes the split also

@burgessa23 That is also strange. For me, using <C-w>c on the popup only closes the popup. The split window remains. Do you have any mappings or plugins that might be causing this behavior?

@carbon-steel I restarted my session and now it seems to be only closing the popup, sorry for the false alarm

I'm also running into this problem. Here's a short video of what I'm doing. Forgive the hideous colors - I've just installed the plugin and haven't tried adjusting my scheme yet.

Screen.Recording.2023-11-15.at.10.07.29.AM-1.mov

I'm using <C-w>c to close, but the same happens with :q

❯ nvim --version
NVIM v0.10.0-dev-847+gc0ac53e0d-Homebrew
Build type: Release
LuaJIT 2.1.0-beta3
Run "nvim -V1 -v" for more info

I think I see what's going on here. Even if there is a popup in front of a window, it is still possible to have your cursor on the window behind the popup (you can see this by cycling through your windows with <C-w>w). If you close the window behind the popup, the popup will close too (this closing behavior is the intentional design of this plugin). Unfortunately, it can be difficult to distinguish whether the cursor is on the popup or the window behind it. So basically, it looks like you're closing the popup, but you're closing the window behind it. The result makes it look like closing the popup also closed a split, but really, it's the reverse. You actually closed the split which caused the popup in front of it to also close.

One way to mitigate this issue is to use a colorscheme that distinguishes between unfocused windows and the focused window.

Or even better, it's easy to just adjust whatever colorscheme you like to use to do this. I like to turn the NormalNC's bg color to be a bit lighter so that unfocused windows look faded. (Though... popups currently seem to have a bug where they don't always show the "focused" colors for some reason. I have an issue for that bug #4)

If anyone thinks that the explanation I presented does not match what is going on in their computer, please comment here. Otherwise, after some time, I'll close this issue.

Turns out that is what's happening. Is there any way to control pop-up / split ordering so we would jump back to the popup after creating that first split? I think it'd be a much more intuitive experience if possible.

@joeblubaugh I think you're right. I created an issue for this feature: #8

Yep. The comment describes what is happening. I am able to "switch" to the pop up after opening a split and close it independently. #8 is a better structured issue.