You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I enabled caching for the Git segment but, after switching branches, noticed that the previous branch was still showing long after the duration should've expired. I noticed this while, testing it, I was just pressing enter with no command, or running ls just to run some command. If I left the terminal sit till the duration expired and hit enter, the right branch was rendered.
It looks like the duration resets every time the segment is rendered:
Or is this the intent? Docs don't say specifically, but it seems like the duration of the segment should not be reset each time the segment is rendered. For a terminal junky like me, it may mean my git branch may never be updated until I go to sleep for the night.
I've been looking through the code and have some idea of a fix - basically have restoreCache in segment.go update the duration remaining and have setCache store that instead, but if you'd rather handle it - or keep it the way it is - that's fine.
FWIW, I found this in the course of investigating to open feature request #6012 and gather ideas about how it might work.
@heaths I believe the setCache logic is flawed as it overrides the cache with a new entry, even when it's restored. It should never set the cache again on restoration otherwise you get that exact issue.
Code of Conduct
What happened?
I enabled caching for the
Git
segment but, after switching branches, noticed that the previous branch was still showing long after the duration should've expired. I noticed this while, testing it, I was just pressing enter with no command, or runningls
just to run some command. If I left the terminal sit till the duration expired and hit enter, the right branch was rendered.It looks like the duration resets every time the segment is rendered:
oh-my-posh/src/config/segment.go
Line 255 in 1a0086f
Or is this the intent? Docs don't say specifically, but it seems like the duration of the segment should not be reset each time the segment is rendered. For a terminal junky like me, it may mean my git branch may never be updated until I go to sleep for the night.
Theme
Custom theme: https://github.com/heaths/oh-my-posh/blob/49064af79cc3c0b188481a93d99ae475673f4bf0/theme.omp.yml#L96-L116
But I added:
What OS are you seeing the problem on?
Linux
Which shell are you using?
bash
Log output
The text was updated successfully, but these errors were encountered: