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

@ -6,21 +6,23 @@ import (
"github.com/jesseduffield/lazygit/pkg/theme"
)
func GetCommitFileListDisplayStrings(branches []*commands.CommitFile) [][]string {
lines := make([][]string, len(branches))
func GetCommitFileListDisplayStrings(commitFiles []*commands.CommitFile, diffName string) [][]string {
lines := make([][]string, len(commitFiles))
for i := range branches {
lines[i] = getCommitFileDisplayStrings(branches[i])
for i := range commitFiles {
diffed := commitFiles[i].Name == diffName
lines[i] = getCommitFileDisplayStrings(commitFiles[i], diffed)
}
return lines
}
// getCommitFileDisplayStrings returns the display string of branch
func getCommitFileDisplayStrings(f *commands.CommitFile) []string {
func getCommitFileDisplayStrings(f *commands.CommitFile, diffed bool) []string {
yellow := color.New(color.FgYellow)
green := color.New(color.FgGreen)
defaultColor := color.New(theme.DefaultTextColor)
diffTerminalColor := color.New(theme.DiffTerminalColor)
var colour *color.Color
switch f.Status {
@ -31,5 +33,8 @@ func getCommitFileDisplayStrings(f *commands.CommitFile) []string {
case commands.PART:
colour = yellow
}
if diffed {
colour = diffTerminalColor
}
return []string{colour.Sprint(f.DisplayString)}
}