mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 21:05:48 +02:00
add new diff mode
WIP WIP WIP WIP WIP WIP WIP
This commit is contained in:
parent
33d287d2f0
commit
40fbce91ce
38 changed files with 465 additions and 136 deletions
|
@ -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)}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue