1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-17 00:18:05 +02:00

better colouring for directories for when adding a patch

This commit is contained in:
Jesse Duffield
2021-03-31 23:00:24 +11:00
parent 7364525bf5
commit 50c169e0a3
3 changed files with 26 additions and 8 deletions

View File

@ -8,21 +8,16 @@ import (
"github.com/jesseduffield/lazygit/pkg/utils"
)
func GetCommitFileLine(name string, diffName string, commitFile *models.CommitFile, patchManager *patch.PatchManager, parent string) string {
func GetCommitFileLine(name string, diffName string, commitFile *models.CommitFile, status patch.PatchStatus) string {
yellow := color.New(color.FgYellow)
green := color.New(color.FgGreen)
defaultColor := color.New(theme.DefaultTextColor)
diffTerminalColor := color.New(theme.DiffTerminalColor)
if commitFile == nil {
return name
}
colour := defaultColor
if diffName == name {
colour = diffTerminalColor
} else if commitFile != nil {
status := patchManager.GetFileStatus(commitFile.Name, parent)
} else {
switch status {
case patch.UNSELECTED:
colour = defaultColor
@ -33,6 +28,10 @@ func GetCommitFileLine(name string, diffName string, commitFile *models.CommitFi
}
}
if commitFile == nil {
return colour.Sprint(name)
}
return utils.ColoredString(commitFile.ChangeStatus, getColorForChangeStatus(commitFile.ChangeStatus)) + " " + colour.Sprint(name)
}