summaryrefslogtreecommitdiffstats
path: root/pkg/gui/presentation
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-03-27 21:25:37 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-03-28 11:59:45 +1100
commitc1a4bd0482ab06279700fa95404131ef24a2297d (patch)
treef3c6a24a7a6cc482fe14f2001d704edefff59bc9 /pkg/gui/presentation
parentd0336fe16f3a365eb9bfff1086a4c02277e1f5dd (diff)
more smart refreshing
WIP WIP WIP WIP WIP fix how diff entries are handled WIP WIP WIP WIP WIP WIP
Diffstat (limited to 'pkg/gui/presentation')
-rw-r--r--pkg/gui/presentation/commits.go26
1 files changed, 17 insertions, 9 deletions
diff --git a/pkg/gui/presentation/commits.go b/pkg/gui/presentation/commits.go
index b54f928ac..d2aff9817 100644
--- a/pkg/gui/presentation/commits.go
+++ b/pkg/gui/presentation/commits.go
@@ -9,10 +9,10 @@ import (
"github.com/jesseduffield/lazygit/pkg/utils"
)
-func GetCommitListDisplayStrings(commits []*commands.Commit, fullDescription bool, cherryPickedCommitShaMap map[string]bool) [][]string {
+func GetCommitListDisplayStrings(commits []*commands.Commit, fullDescription bool, cherryPickedCommitShaMap map[string]bool, diffEntries []*commands.Commit) [][]string {
lines := make([][]string, len(commits))
- var displayFunc func(*commands.Commit, map[string]bool) []string
+ var displayFunc func(*commands.Commit, map[string]bool, []*commands.Commit) []string
if fullDescription {
displayFunc = getFullDescriptionDisplayStringsForCommit
} else {
@@ -20,13 +20,13 @@ func GetCommitListDisplayStrings(commits []*commands.Commit, fullDescription boo
}
for i := range commits {
- lines[i] = displayFunc(commits[i], cherryPickedCommitShaMap)
+ lines[i] = displayFunc(commits[i], cherryPickedCommitShaMap, diffEntries)
}
return lines
}
-func getFullDescriptionDisplayStringsForCommit(c *commands.Commit, cherryPickedCommitShaMap map[string]bool) []string {
+func getFullDescriptionDisplayStringsForCommit(c *commands.Commit, cherryPickedCommitShaMap map[string]bool, diffEntries []*commands.Commit) []string {
red := color.New(color.FgRed)
yellow := color.New(color.FgYellow)
green := color.New(color.FgGreen)
@@ -52,8 +52,6 @@ func getFullDescriptionDisplayStringsForCommit(c *commands.Commit, cherryPickedC
shaColor = blue
case "reflog":
shaColor = blue
- case "selected":
- shaColor = magenta
default:
shaColor = defaultColor
}
@@ -62,6 +60,12 @@ func getFullDescriptionDisplayStringsForCommit(c *commands.Commit, cherryPickedC
shaColor = copied
}
+ for _, entry := range diffEntries {
+ if c.Sha == entry.Sha {
+ shaColor = magenta
+ }
+ }
+
tagString := ""
secondColumnString := blue.Sprint(utils.UnixToDate(c.UnixTimestamp))
if c.Action != "" {
@@ -76,7 +80,7 @@ func getFullDescriptionDisplayStringsForCommit(c *commands.Commit, cherryPickedC
return []string{shaColor.Sprint(c.ShortSha()), secondColumnString, yellow.Sprint(truncatedAuthor), tagString + defaultColor.Sprint(c.Name)}
}
-func getDisplayStringsForCommit(c *commands.Commit, cherryPickedCommitShaMap map[string]bool) []string {
+func getDisplayStringsForCommit(c *commands.Commit, cherryPickedCommitShaMap map[string]bool, diffEntries []*commands.Commit) []string {
red := color.New(color.FgRed)
yellow := color.New(color.FgYellow)
green := color.New(color.FgGreen)
@@ -102,8 +106,6 @@ func getDisplayStringsForCommit(c *commands.Commit, cherryPickedCommitShaMap map
shaColor = blue
case "reflog":
shaColor = blue
- case "selected":
- shaColor = magenta
default:
shaColor = defaultColor
}
@@ -112,6 +114,12 @@ func getDisplayStringsForCommit(c *commands.Commit, cherryPickedCommitShaMap map
shaColor = copied
}
+ for _, entry := range diffEntries {
+ if c.Sha == entry.Sha {
+ shaColor = magenta
+ }
+ }
+
actionString := ""
tagString := ""
if c.Action != "" {