Open cdelledonne opened 10 months ago
Possibly related to #92 and #34
I've done some more digging, here's what I concluded:
By default, an update to the winbar is only performed on the events WinResized
, BufWinEnter
, CursorMoved
, InsertLeave
, as defined by barbecue. However, opening a terminal with e.g. termopen()
does not trigger any of the above events. Nevertheless, when running the command passed to termopen()
, some lines are appended to the terminal buffer, and this triggers CursorMoved
as a side effect (or so it seems). This event is actually triggered two times when launching termopen()
directly, but only one time when launching it as part of the function TestBarbecue()
defined in the original description of this issue. This discrepancy seems to be enough for the unexpected behavior described above.
Given that, I would think that there should be an additional event that should perform a winbar update, and this event should be triggered when launching a terminal. More in general, there should be an event that's triggered whenever buftype
changes for the current buffer, but as far as I know this only happens when launching a terminal.
Based on this assumption, I tried adding TermOpen
to the list of events that perform a winbar update, but this does not solve the problem. The function update()
in lua/barbecue/ui.lua does not seem to have the logic to disable the winbar for a buffer whose buftype
has just changed.
Does this make sense?
Requirements
Expected Behavior
If I just start a terminal by for instance running
:call termopen(['ls'], {})
, there is no winbar in the current window (the current window is occupied by the terminal buffer). This is the behavior that I expect from barbecue.Now, I would also expect this behavior to be the same when doing the following set of actions
This is expressed by this function:
Actual Behavior
When calling the function defined above as
:call TestBarbecue()
, what I get is that there is a winbar in the window occupied by the terminal buffer. This is not expected (nor wanted, in my use case).Removing the line
call win_gotoid(l:orig_winid)
restores the expected behavior, i.e. no winbar in the terminal window. Interestingly, keeping the linecall win_gotoid(l:orig_winid)
but adding asleep 1m
just before the call totermopen()
also restores the expected behavior.Neovim Version
Minimal Configuration
Simple
init.vim
to reproduce the issue:Reproduction
TestBarbecue()
as specified in Expected Behavior:call TestBarbecue()