1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

add new diff mode

WIP

WIP

WIP

WIP

WIP

WIP

WIP
This commit is contained in:
Jesse Duffield
2020-03-29 14:34:17 +11:00
parent 33d287d2f0
commit 40fbce91ce
38 changed files with 465 additions and 136 deletions

View File

@ -7,10 +7,10 @@ import (
"github.com/jesseduffield/lazygit/pkg/utils"
)
func GetReflogCommitListDisplayStrings(commits []*commands.Commit, fullDescription bool) [][]string {
func GetReflogCommitListDisplayStrings(commits []*commands.Commit, fullDescription bool, diffName string) [][]string {
lines := make([][]string, len(commits))
var displayFunc func(*commands.Commit) []string
var displayFunc func(*commands.Commit, bool) []string
if fullDescription {
displayFunc = getFullDescriptionDisplayStringsForReflogCommit
} else {
@ -18,23 +18,27 @@ func GetReflogCommitListDisplayStrings(commits []*commands.Commit, fullDescripti
}
for i := range commits {
lines[i] = displayFunc(commits[i])
diffed := commits[i].Sha == diffName
lines[i] = displayFunc(commits[i], diffed)
}
return lines
}
func getFullDescriptionDisplayStringsForReflogCommit(c *commands.Commit) []string {
defaultColor := color.New(theme.DefaultTextColor)
func getFullDescriptionDisplayStringsForReflogCommit(c *commands.Commit, diffed bool) []string {
colorAttr := theme.DefaultTextColor
if diffed {
colorAttr = theme.DiffTerminalColor
}
return []string{
utils.ColoredString(c.ShortSha(), color.FgBlue),
utils.ColoredString(utils.UnixToDate(c.UnixTimestamp), color.FgMagenta),
defaultColor.Sprint(c.Name),
utils.ColoredString(c.Name, colorAttr),
}
}
func getDisplayStringsForReflogCommit(c *commands.Commit) []string {
func getDisplayStringsForReflogCommit(c *commands.Commit, diffed bool) []string {
defaultColor := color.New(theme.DefaultTextColor)
return []string{utils.ColoredString(c.ShortSha(), color.FgBlue), defaultColor.Sprint(c.Name)}