Skip to content
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: winopts.preview.hidden = 'hidden' not respected after recent updates #1584

Closed
4 of 6 tasks
Bekaboo opened this issue Dec 18, 2024 · 8 comments
Closed
4 of 6 tasks
Labels
bug Something isn't working

Comments

@Bekaboo
Copy link
Contributor

Bekaboo commented Dec 18, 2024

RTFM Checklist

  • I have searched exisiting issues / discussions
  • I have read the Wiki including the Advanced section
  • I have read man fzf / I am well versed in shell fzf

Operating system

Linux

Shell

fish

Neovim version (nvim --version)

v0.10.2

Fzf version (fzf --version)

0.56.3 (add1aec6)

Output of :lua print(os.getenv('FZF_DEFAULT_OPTS'))

--reverse --preview='fzf-file-previewer {}' --preview-window=right,55%,border-sharp,nocycle --info=inline-right --no-separator --no-scrollbar --border=none --margin=1,0,0 --height=~45% --min-height=16 --scroll-off=999 --multi --ansi --color=fg:-1,bg:-1,hl:bold:cyan --color=fg+:-1,bg+:-1,hl+:bold:cyan --color=border:white,preview-border:white --color=marker:bold:cyan,prompt:bold:red,pointer:bold:red --color=gutter:-1,info:bold:red,spinner:cyan,header:white --bind=ctrl-k:kill-line --bind=alt-a:toggle-all --bind=alt-{:first,alt-}:last --bind=shift-up:preview-up,shift-down:preview-down --bind=alt-v:preview-half-page-up,ctrl-v:preview-half-page-down

Is the problem reproducible with mini.sh?

  • My issue is reproducible with mini.sh
  • My issue IS NOT reproducible with mini.sh
  • I have not tested with mini.sh (not relevant, requires LSP, Windows, etc)

Fzf-lua configuration

local tmp = vim.env.TMPDIR
  or vim.env.TEMPDIR
  or vim.env.TMP
  or vim.env.TEMP
  or '/tmp'
local data = tmp .. '/' .. (vim.env.NVIM_APPNAME or 'nvim')
local packages_root = data .. '/site'
local cloned_root = packages_root .. '/pack/packages/start'

local plugins = {
  ['fzf-lua'] = 'https://github.com/ibhagwan/fzf-lua.git',
}

vim.fn.mkdir(cloned_root, 'p')
vim.opt.pp:prepend(packages_root)
vim.opt.rtp:prepend(packages_root)

for plugin_name, url in pairs(plugins) do
  local plugin_path = cloned_root .. '/' .. plugin_name
  if not vim.loop.fs_stat(plugin_path) then
    vim.fn.system({ 'git', 'clone', url, plugin_path })
  end
end

require('fzf-lua').setup({
  -- Use nbsp in tty to avoid showing box chars
  nbsp = not vim.go.termguicolors and '\xc2\xa0' or nil,
  winopts = {
    backdrop = 100,
    split = 'botright new',
    preview = {
      hidden = 'hidden',
    },
  },
})

-- stylua: ignore start
vim.api.nvim_set_keymap('n', '<C-\\>', [[<Cmd>lua require'fzf-lua'.buffers()<CR>]], {})
vim.api.nvim_set_keymap('n', '<C-k>', [[<Cmd>lua require'fzf-lua'.builtin()<CR>]], {})
vim.api.nvim_set_keymap('n', '<C-p>', [[<Cmd>lua require'fzf-lua'.files()<CR>]], {})
vim.api.nvim_set_keymap('n', '<C-l>', [[<Cmd>lua require'fzf-lua'.live_grep_glob()<CR>]], {})
vim.api.nvim_set_keymap('n', '<C-g>', [[<Cmd>lua require'fzf-lua'.grep_project()<CR>]], {})
vim.api.nvim_set_keymap('n', '<F1>', [[<Cmd>lua require'fzf-lua'.help_tags()<CR>]], {})
-- stylua: ignore end

Describe the bug / steps to reproduce

winopts.preview.hidden is not respected if winopts.split is set.

In commit 0063769, this disables the preview window. However the option is not respected in the latest commit (commit 887f584).

Steps to reproduce:

  1. Save the configuration above as minimal.lua
  2. nvim --clean -u minimal.lua
  3. Press <C-\> to open the buffers picker
  4. The preview window is shown (undesired, should be hidden)

image

The bug cannot be reproduced when using floating window layout.

@Bekaboo Bekaboo added the bug Something isn't working label Dec 18, 2024
@Bekaboo
Copy link
Contributor Author

Bekaboo commented Dec 18, 2024

Closing this as I cannot reproduce this anymore 😅

@Bekaboo Bekaboo closed this as completed Dec 18, 2024
@ibhagwan
Copy link
Owner

Ty for the update, I might have accidentally messed it up in 7836b37 and fixed it in c501172 so you might have been caught in between updates today.

@Bekaboo
Copy link
Contributor Author

Bekaboo commented Dec 18, 2024

I have to open this again because the bug appears again and I can reproduce the bug 50% of the time with the provided minimal config. Don't know why it is unstable.

@Bekaboo Bekaboo reopened this Dec 18, 2024
@ibhagwan
Copy link
Owner

I have to open this again because the bug appears again and I can reproduce the bug 50% of the time with the provided minimal config. Don't know why it is unstable.

Might be related to fzf's alternate layout which changes the rotation based on available width.

Is it possible this happens only on certain width due to the split command botright new?

@ibhagwan
Copy link
Owner

If this is the issue, setting layout="horizontal" or "vertical" (or increasing flip_columns) shoud work around it.

Ths is the relevant upstream issue, junegunn/fzf#4100.

To solve this I'd need to go back to using a transform action to rotate the preview based on width and not use fzf's builtin "alternate layout" functionality.

@Bekaboo
Copy link
Contributor Author

Bekaboo commented Dec 18, 2024

Thanks for your reply! It's getting really late and I will test it tomorrow.

@ibhagwan
Copy link
Owner

@Bekaboo, 0527d79 this should fix the starting state 100% of the times.

There will still be an issue if you toggle the preview and then resize the screen triggering an fzf layout change as it the hidden state is separate for each layout as per junegunn/fzf#4100, I do plan on changing this to a transform one day but there's no rush on it.

@Bekaboo
Copy link
Contributor Author

Bekaboo commented Dec 18, 2024

If this is the issue, setting layout="horizontal" or "vertical" (or increasing flip_columns) shoud work around it.

Thanks, this works.

There will still be an issue if you toggle the preview and then resize the screen triggering an fzf layout change as it the hidden state is separate for each layout as per junegunn/fzf#4100, I do plan on changing this to a transform one day but there's no rush on it.

<3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants