trouble.nvim icon indicating copy to clipboard operation
trouble.nvim copied to clipboard

closing trouble gives focus back to the wrong window

Open deecewan opened this issue 4 years ago • 10 comments
trafficstars

Suppose you have two windows open, and . is current cursor position

|--------------|-------------|
|              | .           |
|              |             |
|      1       |      2      |
|              |             |
|              |             |
|--------------|-------------|

running :Trouble opens the window and gives focus to the window (new . below)

|--------------|-------------|
|              |             |
|              |             |
|      1       |      2      |
|              |             |
|              |             |
|--------------|-------------|
| .                          |
|           trouble          |
|----------------------------|

now, pressing q (default keymap) results in the cursor going back to window 1

|--------------|-------------|
| .            |             |
|              |             |
|      1       |      2      |
|              |             |
|              |             |
|--------------|-------------|

where i feel it should probably go back to it's previous position in window 2

deecewan avatar Jul 15 '21 00:07 deecewan

Were you able to fix this? I'm having the same issue here.

regexPattern avatar Aug 08 '21 14:08 regexPattern

i was not able to fix it. i wouldn't even know where/how to start 😬

deecewan avatar Aug 09 '21 04:08 deecewan

This is definitely a bug. Unfortunately I'm leaving on a vacation tomorrow, but I'll look into it once I'm back end of August.

folke avatar Aug 09 '21 22:08 folke

i implemented a fix in https://github.com/folke/trouble.nvim/pull/72 - i've not built any vim plugins before so not 100% sure if that's correct, but it works for me locally @folke

deecewan avatar Aug 10 '21 02:08 deecewan

@deecewan I'm traveling right now and didn't bring my laptop. Looking at your fix I think I know what's happening here. The switch to is doing pretty much what you do, with that difference that we set the current window first. Doing that triggers some autocmds inside trouble probably. I'll work on a proper fix once I'm back.

folke avatar Aug 13 '21 04:08 folke

the current implementation never sets the window.

either way, there's no rush 😄 i'm using my fork for now

deecewan avatar Aug 13 '21 04:08 deecewan

@folke any advance on this issue, or the attached PR (#72)? It'd be good to get back to the mainline 😄

deecewan avatar Sep 09 '21 11:09 deecewan

I had to revert the PR, since it segfaults in combination with WhichKey somehow. I'll see for another way to fix this.

folke avatar Oct 22 '21 14:10 folke

That's odd, the fix has the classic case of "works on my machine" even though I make extensive use of WhichKey. Which is awesome like all of your plugins, thank you for all your work @folke ^^

okuuva avatar Sep 30 '22 06:09 okuuva

☝️ yeah i have both installed, and did the fix, and never noticed a problem

deecewan avatar Oct 02 '22 22:10 deecewan

Development on the main branch is EOL.

Trouble has been rewritten and will be merged in main soon.

This issue/feature either no longer exists or has been implemented on dev.

For more info, see https://github.com/folke/trouble.nvim/tree/dev

folke avatar Mar 29 '24 07:03 folke