nvim-lualine / lualine.nvim

A blazing fast and easy to configure neovim statusline plugin written in pure lua.
MIT License
6.03k stars 463 forks source link

Bug: FugitiveHead messes up menu tab completion #888

Open rkulla opened 1 year ago

rkulla commented 1 year ago

Self Checks

How to reproduce the problem

Expected behaviour

:Packer[tab] cycles through whole menu

Actual behaviour

:Packer[tab] doesn't cycle through whole menu. (:Packer is just an example but really any :Command[tab] has same issue)

Minimal config to reproduce the issue

lualine_a = {'FugitiveHead'},

Aditional information

This works fine: lualine_a = {'branch'},

It's only when I use FugitiveHead that this happens. I tried most combinations of vim-fugitive being in start/ or opt/ and/or lualine being in start/ or /opt.

rkulla commented 1 year ago

It also happens with or without adding extensions = {'fugitive'}

shadmansaleh commented 1 year ago

I can't reproduce it. The completion cycling is working correctly for me with FugitiveHead. To be honest, here we are doing nothing but calling the FugitiveHead() viml function that vim-fugitive provides. It seems unlikely that this is a lualine bug.

https://github.com/nvim-lualine/lualine.nvim/blob/3325d5d43a7a2bc9baeef2b7e58e1d915278beaf/lua/lualine/components/special/eval_func_component.lua#L19-L21

rkulla commented 1 year ago

Interesting. It was the only way I could reproduce it but it must be something else conflicting with it then. Thanks.

ViViDboarder commented 1 year ago

I did some debugging and was able to narrow this down to a combination of using FugitiveHead along with the change introduced in this commit for vim-fugitive: https://github.com/tpope/vim-fugitive/commit/4b0f2b604

I found that commit by running git bisect on the Fugitive tree between known working good and bad versions.

ViViDboarder commented 1 year ago

I walked through changes within that diff and it turns out when expand() is called on line 401, it produces the bug. The expand call itself works and doesn't appear to error, however if I replace expand('~') with /home/vividboarder, the bug goes away. If I wrap the known directory with expand again (expand('/home/vividboarder')) it returns. So I'm fairly confident it's to do with the expand(...) function being called in this context.

To avoid the issue for now, you can pin vim-fugitive just before this commit or at the previous tag, v3.6.

ViViDboarder commented 1 year ago

I reproduced the issue without vim-fugitive by simply adding local _ = vim.fn.expand('~') to one of my existing lualine section functions. Interestingly, local _ = vim.fn.expand('%') does not produce this issue. So there is something likely going on within expand(...).

expand result
expand('~') bad
expand('/') bad
expand('') bad
expand('%') ok
ViViDboarder commented 1 year ago

Found a related neovim issue: https://github.com/neovim/neovim/issues/10121.

ViViDboarder commented 1 year ago

This is definitely due to a Neovim bug, but there's probably not much value in refreshing the status line when the cursor moves through items in the wildmenu. If this can be determined and short-circuiting from the refresh function, then the bug would be mitigated and result in a minor improvement to runtime experience.

lalitmeeq commented 1 year ago

For me, it is different a little bit. After closing fugitive.nvim window, the branch component in the lualine goes away and then I will have to take action to update the lualine.nvim.

rkulla-hbo commented 1 year ago

Does seem to work in newer neovim's that fixed the expand bug. Thanks.