@@ -85,11 +85,11 @@ func (d *direction) UnmarshalYAML(value *yaml.Node) error {
8585}
8686
8787type options struct {
88- BranchMaxLen int `yaml:"branch_max_len"`
89- BranchTrim direction `yaml:"branch_trim"`
90- Ellipsis string `yaml:"ellipsis"`
91- HideClean bool `yaml:"hide_clean"`
92- SwapDivergence bool `yaml:"swap_divergence"`
88+ BranchMaxLen int `yaml:"branch_max_len"`
89+ BranchTrim direction `yaml:"branch_trim"`
90+ Ellipsis string `yaml:"ellipsis"`
91+ HideClean bool `yaml:"hide_clean"`
92+ SwapDivergence bool `yaml:"swap_divergence"`
9393}
9494
9595// A Formater formats git status to a tmux style string.
@@ -135,6 +135,8 @@ func truncate(s, ellipsis string, max int, dir direction) string {
135135
136136// Format writes st as json into w.
137137func (f * Formater ) Format (w io.Writer , st * gitstatus.Status ) error {
138+ defer fmt .Fprintf (w , "%s" , f .Styles .Clear )
139+
138140 f .st = st
139141
140142 // Overall working tree state
@@ -241,23 +243,23 @@ func (f *Formater) divergence() string {
241243 return ""
242244 }
243245
244- behind := ""
245- ahead := ""
246+ behind := ""
247+ ahead := ""
246248 s := f .Styles .Clear + f .Styles .Divergence
247249 if f .st .BehindCount != 0 {
248- behind = fmt .Sprintf ("%s%d" , f .Symbols .Behind , f .st .BehindCount )
250+ behind = fmt .Sprintf ("%s%d" , f .Symbols .Behind , f .st .BehindCount )
249251 }
250252
251253 if f .st .AheadCount != 0 {
252254 ahead = fmt .Sprintf ("%s%d" , f .Symbols .Ahead , f .st .AheadCount )
253255 }
254256
255257 if ! f .Options .SwapDivergence {
256- // Behind first, ahead second
257- s += behind + ahead
258+ // Behind first, ahead second
259+ s += behind + ahead
258260 } else {
259- // Ahead first, behind second
260- s += ahead + behind
261+ // Ahead first, behind second
262+ s += ahead + behind
261263 }
262264
263265 return s
0 commit comments