-
Notifications
You must be signed in to change notification settings - Fork 469
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
feat: refresh lualine based on timer + winbar support. #736
Conversation
53ebd3f
to
8c45188
Compare
e800bcb
to
38cfa16
Compare
38cfa16
to
6a5958b
Compare
Pull in winbar changes form pr #689 and adapt them Co-authored-by: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com>
2e8857e
to
352c86d
Compare
9177386
to
5aa0196
Compare
5aa0196
to
9e0860b
Compare
Hi, compare to the #689, this PR doesn't respect the configs.options.disabled_filetypes option. The result I got is the |
I don't think that's the case here. We are respecting disabled filetypes but It seems telescope is creating 6 windows but it only marks 2 of those with filetype TelescopeResults and TelescopePrompt. I'm not using floaterm but toggleterm seems to work correctly with disabled_filetype. Maybe floaterm does something similar to telescope. Also it seems floating windows don't use global value of winbar option so in previous pr floating windows didn't have winbar at all even without you adding the filetypes to disabled list |
I wonder if this is desired behaviour in most case. |
Ok now we are ignoring floating windows . telescope should appear correctly now but it also means no winbar on floating windows from lualine. |
Another thing I notice is that this with this branch, my |
@lkhphuc I think a bug in neovim is causing the issue you're facing . I've opened an issue in neovim's repo neovim/neovim#19464 lets what the devs think about it. |
77e380c
to
69027cd
Compare
288d580
to
278d7c1
Compare
I think this branch is quite stable . I can probably merge it already . I anyone want can take it for a spin and see if there are any inconsistencies. |
about not having space in floating windows. This implements a temporary workaround the issue(neovim/neovim#19464) until the bug in neovim gets fixed.
This seems to be causing a problem with |
@willnorris fixed in 6fbc35b |
Usually the statusline is set once at the startup of vim to a function that evaluates to the dynamic value of the statusline at runtime. However some statuslines are particularly retarded and completely shit on this vim idiomatic way of setting the statusline and instead update the stl vim option directly, e.g. with a timer and on autocmd events. This is not only completely stupid, but also has slightly worse performance and is in fact also semantically incorrect (e.g. there is not an autocmd for every way that it is possible to update the statusline, only for most of the scenarios). This is now the second time that lualine does something in a completely fucked up way (the first time was the way that they pretend to have global statusline support, by simply setting the laststatus option if a lualine option is set, completely ignoring the idiomatic way of simply letting the user set the laststatus option directly). Why again are so many people recommending lualine? They seem to know jack shit about the idiomatic way to do things in vim. The bad commit in lualine is 53aa3d82d9d9329880b4197f278fcb74051a6af5. Of course this also breaks our plugin because of the way that g:tpipeline_statusline interacts with &stl. To workaround the issue, we do not set g:tpipeline_statusline if we are in neovim. Then in the update routine we first evaluate g:tpipeline_statusline (to not break users configs that set this variable) and then try &stl as fallback. For now we only implement this workaround for neovim, as I don't believe there is any vim statusline plugin that uses stl in such a fucked up way. Congrats lualine, we know have an extra workaround just for you. Fixes #32 ref: nvim-lualine/lualine.nvim@53aa3d8 ref: nvim-lualine/lualine.nvim#736
This isn't really necessary for any sane statusline. But of course this is a world where lualine exists. Lualine is using a cursed timer-based update [0], where they update the statusline option directly instead of using a function indirection like literally every single sane statusline plugin in existance. As I have explained several times in the past, this introduces many problems, even for vanilla lualine users without any other plugin involved (e.g. some statusline updates will not trigger lualine's timer-based update, so even vanilla lualine may sometimes have a slight lag). This is now the third time that lualine's inability to follow basic vim idiomatic patterns has caused us painful regressions [1]. In this case the regression occurred because there seems to be an autocmd order conflict, which causes tpipeline to miss the most recent statusline update and lag behind exactly one iteration. Lualine should just switch back to the sane function indirection pattern, but these days a majority of neovim plugin devs seem to be completely immune to following vim best practices... Fixes #50 [0] nvim-lualine/lualine.nvim#736 [1] See commit affe9ca
) * feat: refresh lualine based on timer. * fix config test * fix lag on win change issue * handle errors in timer callback * feat: add winbar support Pull in winbar changes form pr nvim-lualine#689 and adapt them Co-authored-by: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com> * make winbar disapear when winbar evals empty * only update stl of curwin with globalstatus * properly clear win local stl and wbr opts * add version guards for winbar feature * only add winbar if height > 1 * fix tests? * refresh lualine on ModeChanged event * ignore floating windows for refresh * properply restore options to previous state * fix stl not updating in cmd mode + some optimizations * fix tests on <nvim-0.7 * merge status_dispatch & winbar_dispatch + winbar support for extensions * fix globalstatus option not live updating * update docs * feat: allow disabling winbar and statusline separately * fix tests * fix: winbar some times oddly throwing errors about not having space in floating windows. This implements a temporary workaround the issue(neovim/neovim#19464) until the bug in neovim gets fixed. Co-authored-by: Diego Fujii <android.mxdiego9@gmail.com>
What it is
With this lualine will control it's own refresh instead of relying on nvim.
If we refresh this way we should be able to change out the statusline, winbar, tabline options and still be running . We should be able to address #689 (comment) & #395 with this style of update.
Major changes
require('lualine').refresh
function to force refresh lualine . It can refresh all statusline, tabline, winbars or can granularly refresh specific statusline/tabline/winbar of specific windows see the code docs for more info.known Issues/todos:
Refresh time is set to 1s . It seems when changing wins inactive & active stls don't switch immediately instead takes that 1s to update which is quite noticeable . Possible solutions: utilize autocommads to refresh on such events.We need to handle errors in the refresh funcitnon so if we say fail to update 3 times in a row we should stop the timer.looks like nvim wants to put winbars on floating windows too. but it might fail if there aren't enough room like telescopes prompt . that's an issue for us. wonder if we can determine if a win is float or not and skip floats 🤦♂️(skiping winbar on winheight <= 1 & floating windows)try merging statusline_dispatch and winbar_dispatch togather they have a lot of duplicationstatusline doesn't seem to update regularly in cmdline modenvim-0,5 & 0.6 is broken with nvim_opts module . (may we should just have compat tags for older nvim version and be done with them . keeping support for them is getting annoying )live update seems broken for gobalstatus & separators options.yes we have that intro disappearing due to redraw issue again.closes #744 #692
supersedes #689