-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: "FzfLua buffers" shows preview on first call even if preview is disabled #1527
Comments
Note that even direct call
has the same issue (first call shows the preview, all next calls don't). |
Just tested and can’t reproduce this, perhaps something related to your config? Try |
@ibhagwan Couldn't reproduce with default init.lua but could reproduce with my config listed in the description. |
Then debug your config to see where the issue stems from. |
It seems that "max-perf" profile is broken. Couldn't reproduce it with "default". |
Just in case, I could reproduce this issue using mini.sh and "max-perf" profile. |
I tried max- perf with my own config earlier and couldn’t reproduce it, I’ll do some more testing later. |
Good enough, I’ll tackle this later today I hope. |
Just in case, my init.lua for mini.sh I used
|
Strange, just tried the same init.lua with max-perf with neovim 0.10.2 and nightly and can’t reproduce this, I would suspect FZF_DEFAULT_OPTS but you posted in the OP it’s empty. |
@ibhagwan I could try to debug the issue myself next week but I need a little help since I don't have experience with Neovim plugins debugging. Could you point me to a place in the code to start digging - e.g. place where fzf-lua decides "show or don't show preview"? |
My first bet would be what comes in and out of fzf-lua/lua/fzf-lua/config.lua Line 145 in 2a7eb32
Before that we could can you try with debug? It should print the fzf command into :FzfLua buffers winopts.preview.hidden=hidden debug=true |
@ibhagwan In both cases (first when I see preview and next when I don't) have the same output Dump of options is the following
fzf command for first call
For second call
|
Both commands appear to contain |
@ibhagwan Screenshot (for max-perf) Note that for default profile it looks different - takes proper colors from my init.lua when on the first screenshot default fzf colors are used |
This looks correct, the fzf previewer is used which is very confusing why it would appear given the hidden property showing in the command line. I’m suspecting the resize transform is what’s fishing this, can you set preview layout to either horizontal or vertical instead of the default |
@ibhagwan Indeed, using either horizontal or vertical layout resolves the issue. |
This makes sense, the resize event transformer (shell code) currently isn’t able to take into account the current state of the previewer (hidden / nohidden), this may be solved in the future with the introduction of more state variables in fzf, this is a known issue but unrelated to yours. The below is the code bound to Lines 391 to 395 in 2a7eb32
The question remaining is: why is your neovim triggering a terminal resize event when fzf-lua is opened for the first time? I just tried installing fzf 0.56.2 (same neovim version already) and I still can’t reproduce this, unlikely, but perhaps this is related to your terminal app, what terminal are you using? |
I am using Alacritty, but could reproduce the issue with Neovim QT, gnome terminal and even with xterm. So I don't think it is terminal specific. |
I didn’t think so either but had to try. In any event, we know what the issue is and the workaround (do not use flex layout). I will try to think of something to prevent the transform from showing the preview when hidden. |
I'm thinking I can remove the transformer altogether and use alternative preview layout as was added in v0.31, for more info see junegunn/fzf#3817. It might have other side effect so I'll have to do some testing, I also opened junegunn/fzf#4098 in case I'm missing something and we already have access to the preview hidden state. Edit: Also opened junegunn/fzf#4100 as I found another issues with fzf auto layout rotation. |
Use alternative preview layout instead of using a "transform", simpler, and we don't need to take into account the hidden state of the preview as well as decrease the minimum fzf version for native fzf flex layout to 0.31 (instead of 0.46). Has known issue upstream where if the layout changes upon resize the hidden state of the preview is lost: junegunn/fzf#4100 Closes #1527
Use alternative preview layout instead of using a "transform", simpler, and we don't need to take into account the hidden state of the preview as well as decrease the minimum fzf version for native fzf flex layout to 0.31 (instead of 0.46). Has known issue upstream where if the layout changes upon resize the hidden state of the preview is lost: junegunn/fzf#4100 Closes #1527
Use alternative preview layout instead of using a "transform", simpler, and we don't need to take into account the hidden state of the preview as well as decrease the minimum fzf version for native fzf flex layout to 0.31 (instead of 0.46). Has known issue upstream where if the layout changes upon resize the hidden state of the preview is lost: junegunn/fzf#4100 Closes #1527
Use alternative preview layout instead of using a "transform", simpler, and we don't need to take into account the hidden state of the preview as well as decrease the minimum fzf version for native fzf flex layout to 0.31 (instead of 0.46). Has known issue upstream where if the layout changes upon resize the hidden state of the preview is lost: junegunn/fzf#4100 Closes #1527
Use alternative preview layout instead of using a "transform", simpler, and we don't need to take into account the hidden state of the preview as well as decrease the minimum fzf version for native fzf flex layout to 0.31 (instead of 0.46). Has known issue upstream where if the layout changes upon resize the hidden state of the preview is lost: junegunn/fzf#4100 Closes #1527
There's a fix for this issue pending in the refactor_flex branch, I'm still testing the various scenarios as I used this opportunity to further simplify the win object code but it looks good and should solve your issue. The only thing I wasn't able to solve due to junegunn/fzf#4100 is the below scenario (somewhat insignificant):
|
Use alternative preview layout instead of using a "transform", simpler, and we don't need to take into account the hidden state of the preview as well as decrease the minimum fzf version for native fzf flex layout to 0.31 (instead of 0.46). Has known issue upstream where if the layout changes upon resize the hidden state of the preview is lost: junegunn/fzf#4100 Closes #1527
Use alternative preview layout instead of using a "transform", simpler, and we don't need to take into account the hidden state of the preview as well as decrease the minimum fzf version for native fzf flex layout to 0.31 (instead of 0.46). Has known issue upstream where if the layout changes upon resize the hidden state of the preview is lost: junegunn/fzf#4100 Closes #1527
Use alternative preview layout instead of using a "transform", simpler, and we don't need to take into account the hidden state of the preview as well as decrease the minimum fzf version for native fzf flex layout to 0.31 (instead of 0.46). Has known issue upstream where if the layout changes upon resize the hidden state of the preview is lost: junegunn/fzf#4100 Closes #1527
@ibhagwan Indeed, fix resolved the issue. Thank you! Really appreciate your help! |
RTFM Checklist
man fzf
/ I am well versed in shell fzfOperating system
Linux
Shell
bash
Neovim version (
nvim --version
)0.10.2
Fzf version (
fzf --version
)0.56.2
Output of
:lua print(os.getenv('FZF_DEFAULT_OPTS'))
nil
Is the problem reproducible with
mini.sh
?mini.sh
mini.sh
mini.sh
(not relevant, requires LSP, Windows, etc)Fzf-lua configuration
Describe the bug / steps to reproduce
In the latest versions of fzf-lua first call to ":FzfLua buffers" shows preview for files in the buffer list though I have preview disabled in the configuration. All next calls don't have preview window.
The text was updated successfully, but these errors were encountered: