Modular Statusbar - #1394
Conversation
f6d8e51 to
48284f8
Compare
rnpnr
left a comment
There was a problem hiding this comment.
I feel like this is not as flexible as it could be and I generally don't like dynamic lists of functions when they can be avoided.
To summarize: the point we are trying to address is that if the user wants their own status bar adding a WIN_HIGHLIGHT function is a really poor way of doing it since we still need to run the default one.
I do feel like vis.statusbar is moving in the right direction, but maybe it should be window local. How about instead of vis.statusbar being a table it is instead just a function? Then in the default WIN_HIGHLIGHT event we just call that function directly (if it is not nil).
|
What this aims for is not replacing the WIN_STATUS function but making it modular, so plugins can add into the statusbar without replacing or rewriting the statusbar function, if each plugin used their own WIN_STATUS function, then it would be chaos, especially when they probably only want to display a simple status. I'm not quite sure what you mean by WIN_HIGHLIGHT, I haven't messed with it here? For per window status bars is easily doable with creating a win.statusbar on WIN_OPEN and then using that or vis.statusbar as a fallback (WIN_STATUS seems to run before WIN_OPEN) if you want more power from the statusbar, I don't quite know what you mean... I can think of changing the behavior a bit so its more user friendly maybe something like statusbar.actions is a dictionary of functions, (win): string|nil
In the case of @fischerling spell plugin, all that would need to happen is a or it would need an extra WIN_OPEN event that adds it to win.statusbar.left directly, but that seems like a bit of a headache. if vis.statusbar is a function, as you suggest, then I can only think of it as both It being a simple function certainly simplifies things though, I really don't like thinking of metatables, inheritance and trees but it seems a necessity here. |
This allows plugins to be written that can edit vis.statusbar[left, right] thus not completely wiping the WIN_STATUS event function
Is this even a good idea? I wanted far back but now I don't know.