This commit is contained in:
skanehira 2019-03-28 18:58:34 +09:00 committed by Jesse Duffield
parent c350cdba43
commit f34be1896a
7 changed files with 46 additions and 40 deletions

View file

@ -9,11 +9,10 @@ import (
type Commit struct {
Sha string
Name string
Status string // one of "unpushed", "pushed", "merged", or "rebasing"
Status string // one of "unpushed", "pushed", "merged", "rebasing" or "selected"
DisplayString string
Action string // one of "", "pick", "edit", "squash", "reword", "drop", "fixup"
Copied bool // to know if this commit is ready to be cherry-picked somewhere
Selected bool
}
// GetDisplayStrings is a function.
@ -24,6 +23,7 @@ func (c *Commit) GetDisplayStrings(isFocused bool) []string {
blue := color.New(color.FgBlue)
cyan := color.New(color.FgCyan)
white := color.New(color.FgWhite)
magenta := color.New(color.FgMagenta)
// for some reason, setting the background to blue pads out the other commits
// horizontally. For the sake of accessibility I'm considering this a feature,
@ -40,6 +40,8 @@ func (c *Commit) GetDisplayStrings(isFocused bool) []string {
shaColor = green
case "rebasing":
shaColor = blue
case "selected":
shaColor = magenta
default:
shaColor = white
}
@ -53,12 +55,5 @@ func (c *Commit) GetDisplayStrings(isFocused bool) []string {
actionString = cyan.Sprint(utils.WithPadding(c.Action, 7)) + " "
}
name := ""
if c.Selected {
name = color.New(color.FgMagenta).Sprint(c.Name)
} else {
name = white.Sprint(c.Name)
}
return []string{shaColor.Sprint(c.Sha), actionString + name}
return []string{shaColor.Sprint(c.Sha), actionString + white.Sprint(c.Name)}
}