diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-03-31 23:00:24 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-02 11:00:15 +1100 |
commit | 50c169e0a30597c4e1da85f2e1b9b27958dfe5a6 (patch) | |
tree | 0a0606d6c9e0884e0cc8e4407d0b527fbb9dc8ce /pkg/gui/presentation | |
parent | 7364525bf5ae7b6b4ff8f0e4381e1014726219ad (diff) |
better colouring for directories for when adding a patch
Diffstat (limited to 'pkg/gui/presentation')
-rw-r--r-- | pkg/gui/presentation/commit_files.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/pkg/gui/presentation/commit_files.go b/pkg/gui/presentation/commit_files.go index 4980f6c50..94116066a 100644 --- a/pkg/gui/presentation/commit_files.go +++ b/pkg/gui/presentation/commit_files.go @@ -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) } |