Closed mehalter closed 3 months ago
It shouldn't encounter the issue you described because transparent.nvim has already taken that scenario into consideration. transparent.nvim will execute multiple times.
Maybe it needs to do it a few more times 😅 I'm not sure
It's definitely hard to solve a non-deterministic delay with deterministic delays
@mehalter
I reviewed your described scenario, and it seems you want to clear it yourself. If that's the case, you can directly call require('transparent').clear()
.
I think I see the confusion here and the reason your application of clear
several times also doesn't solve the problem. I don't want the clear()
function to be the last thing called. The use case is I want to make sure some things are explicitly called after clear()
is finished resolving. In the case of updating colors for a statusline like Heirline I want to guarantee that the color update happens after the highlight groups are cleared. So if I have an autocommand for Heirline on ColorScheme
and your plugin also is on ColorScheme
, there is a race condition where Heirline might update its colors on the non-transparent highlight groups before they are cleared. This is where something like a user autocommand event comes in place or a post clear hook function comes in. Either I can add the user autocommand event to my already existing autocommand, or I can add to some post_hook
function which guarantees some code happens explicitly after the colorscheme has "settled" and nothing else is changing.
Hopefully this clears up any confusion, let me know if anything doesn't make sense :D
I use Heirline for my
statusline
andtabline
which refreshes the highlights on an autocommand on thecolorscheme
event. This means that when I use it alongside this plugin there is a race condition on when the highlights are cleared or not. It would be nice to have a configuration option to run an arbitrary function after the highlight groups change that way I can call the function to refresh my statusline colors.Thanks so much for a great plugin!