@@ -85,11 +85,11 @@ func (d *direction) UnmarshalYAML(value *yaml.Node) error {
85
85
}
86
86
87
87
type 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"`
93
93
}
94
94
95
95
// A Formater formats git status to a tmux style string.
@@ -135,6 +135,8 @@ func truncate(s, ellipsis string, max int, dir direction) string {
135
135
136
136
// Format writes st as json into w.
137
137
func (f * Formater ) Format (w io.Writer , st * gitstatus.Status ) error {
138
+ defer fmt .Fprintf (w , "%s" , f .Styles .Clear )
139
+
138
140
f .st = st
139
141
140
142
// Overall working tree state
@@ -241,23 +243,23 @@ func (f *Formater) divergence() string {
241
243
return ""
242
244
}
243
245
244
- behind := ""
245
- ahead := ""
246
+ behind := ""
247
+ ahead := ""
246
248
s := f .Styles .Clear + f .Styles .Divergence
247
249
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 )
249
251
}
250
252
251
253
if f .st .AheadCount != 0 {
252
254
ahead = fmt .Sprintf ("%s%d" , f .Symbols .Ahead , f .st .AheadCount )
253
255
}
254
256
255
257
if ! f .Options .SwapDivergence {
256
- // Behind first, ahead second
257
- s += behind + ahead
258
+ // Behind first, ahead second
259
+ s += behind + ahead
258
260
} else {
259
- // Ahead first, behind second
260
- s += ahead + behind
261
+ // Ahead first, behind second
262
+ s += ahead + behind
261
263
}
262
264
263
265
return s
0 commit comments