Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set 'Clear' to #[none] #108

Merged
merged 3 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Cosmetics
  • Loading branch information
arl committed Jan 2, 2024
commit f2eadae667b6df2f6610a561b4ea40fb68ecf26b
3 changes: 2 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
_ "embed"
"fmt"

"github.com/arl/gitmux/tmux"
"gopkg.in/yaml.v3"

"github.com/arl/gitmux/tmux"
)

// Config configures output formatting.
Expand Down
24 changes: 12 additions & 12 deletions tmux/formater.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ func (d *direction) UnmarshalYAML(value *yaml.Node) error {
}

type options struct {
BranchMaxLen int `yaml:"branch_max_len"`
BranchTrim direction `yaml:"branch_trim"`
Ellipsis string `yaml:"ellipsis"`
HideClean bool `yaml:"hide_clean"`
SwapDivergence bool `yaml:"swap_divergence"`
BranchMaxLen int `yaml:"branch_max_len"`
BranchTrim direction `yaml:"branch_trim"`
Ellipsis string `yaml:"ellipsis"`
HideClean bool `yaml:"hide_clean"`
SwapDivergence bool `yaml:"swap_divergence"`
}

// A Formater formats git status to a tmux style string.
Expand Down Expand Up @@ -241,23 +241,23 @@ func (f *Formater) divergence() string {
return ""
}

behind := ""
ahead := ""
behind := ""
ahead := ""
s := f.Styles.Clear + f.Styles.Divergence
if f.st.BehindCount != 0 {
behind = fmt.Sprintf("%s%d", f.Symbols.Behind, f.st.BehindCount)
behind = fmt.Sprintf("%s%d", f.Symbols.Behind, f.st.BehindCount)
}

if f.st.AheadCount != 0 {
ahead = fmt.Sprintf("%s%d", f.Symbols.Ahead, f.st.AheadCount)
}

if !f.Options.SwapDivergence {
// Behind first, ahead second
s += behind + ahead
// Behind first, ahead second
s += behind + ahead
} else {
// Ahead first, behind second
s += ahead + behind
// Ahead first, behind second
s += ahead + behind
}

return s
Expand Down