diff options
-rw-r--r-- | pkg/commands/patch/patch_parser.go | 13 | ||||
-rw-r--r-- | pkg/gui/branches_panel.go | 2 | ||||
-rw-r--r-- | pkg/gui/mergeconflicts/rendering.go | 2 | ||||
-rw-r--r-- | pkg/gui/presentation/branches.go | 10 | ||||
-rw-r--r-- | pkg/gui/presentation/commits.go | 2 | ||||
-rw-r--r-- | pkg/gui/presentation/remote_branches.go | 6 | ||||
-rw-r--r-- | pkg/gui/presentation/remotes.go | 6 | ||||
-rw-r--r-- | pkg/gui/presentation/stash_entries.go | 6 | ||||
-rw-r--r-- | pkg/gui/presentation/tags.go | 6 | ||||
-rw-r--r-- | pkg/gui/status_panel.go | 2 |
10 files changed, 28 insertions, 27 deletions
diff --git a/pkg/commands/patch/patch_parser.go b/pkg/commands/patch/patch_parser.go index 12426a3df..4fb8eb68b 100644 --- a/pkg/commands/patch/patch_parser.go +++ b/pkg/commands/patch/patch_parser.go @@ -118,15 +118,16 @@ func coloredString(textStyle style.TextStyle, str string, selected bool, include textStyle = textStyle.MergeStyle(theme.SelectedRangeBgColor) } - if len(str) < 2 { - return textStyle.Sprint(str) + firstCharStyle := textStyle + if included { + firstCharStyle = firstCharStyle.MergeStyle(style.BgGreen) } - res := textStyle.Sprint(str[:1]) - if included { - return res + textStyle.MergeStyle(style.BgGreen).Sprint(str[1:]) + if len(str) < 2 { + return firstCharStyle.Sprint(str) } - return res + textStyle.Sprint(str[1:]) + + return firstCharStyle.Sprint(str[:1]) + textStyle.Sprint(str[1:]) } func parsePatch(patch string) ([]int, []int, []*PatchLine) { diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 0c5a2d7d2..d5438bc16 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -554,7 +554,7 @@ func (gui *Gui) findBranchNameSuggestions(input string) []*types.Suggestion { for i, branchName := range matchingBranchNames { suggestions[i] = &types.Suggestion{ Value: branchName, - Label: presentation.GetBranchColor(branchName).Sprint(branchName), + Label: presentation.GetBranchTextStyle(branchName).Sprint(branchName), } } diff --git a/pkg/gui/mergeconflicts/rendering.go b/pkg/gui/mergeconflicts/rendering.go index 67aa6c49d..45fff634a 100644 --- a/pkg/gui/mergeconflicts/rendering.go +++ b/pkg/gui/mergeconflicts/rendering.go @@ -21,7 +21,7 @@ func ColoredConflictFile(content string, state *State, hasFocus bool) string { } if hasFocus && state.conflictIndex < len(state.conflicts) && *state.conflicts[state.conflictIndex] == *conflict && shouldHighlightLine(i, conflict, state.conflictTop) { - textStyle = theme.SelectedRangeBgColor.SetBold() + textStyle = textStyle.MergeStyle(theme.SelectedRangeBgColor).SetBold() } if i == conflict.end && len(remainingConflicts) > 0 { conflict, remainingConflicts = shiftConflict(remainingConflicts) diff --git a/pkg/gui/presentation/branches.go b/pkg/gui/presentation/branches.go index 548bd143c..9b35b5c3c 100644 --- a/pkg/gui/presentation/branches.go +++ b/pkg/gui/presentation/branches.go @@ -27,11 +27,11 @@ func getBranchDisplayStrings(b *models.Branch, fullDescription bool, diffed bool displayName = b.DisplayName } - nameColorAttr := GetBranchColor(b.Name) + nameTextStyle := GetBranchTextStyle(b.Name) if diffed { - nameColorAttr = theme.DiffTerminalColor + nameTextStyle = theme.DiffTerminalColor } - coloredName := nameColorAttr.Sprint(displayName) + coloredName := nameTextStyle.Sprint(displayName) if b.IsTrackingRemote() { coloredName = fmt.Sprintf("%s %s", coloredName, ColoredBranchStatus(b)) } @@ -48,8 +48,8 @@ func getBranchDisplayStrings(b *models.Branch, fullDescription bool, diffed bool return res } -// GetBranchColor branch color -func GetBranchColor(name string) style.TextStyle { +// GetBranchTextStyle branch color +func GetBranchTextStyle(name string) style.TextStyle { branchType := strings.Split(name, "/")[0] switch branchType { diff --git a/pkg/gui/presentation/commits.go b/pkg/gui/presentation/commits.go index 5823a7153..0743fd14e 100644 --- a/pkg/gui/presentation/commits.go +++ b/pkg/gui/presentation/commits.go @@ -59,7 +59,7 @@ func getFullDescriptionDisplayStringsForCommit(c *models.Commit, cherryPickedCom if c.Action != "" { secondColumnString = actionColorMap(c.Action).Sprint(c.Action) } else if c.ExtraInfo != "" { - tagString = theme.DiffTerminalColor.SetBold().Sprint(c.ExtraInfo) + " " + tagString = style.FgMagenta.SetBold().Sprint(c.ExtraInfo) + " " } truncatedAuthor := utils.TruncateWithEllipsis(c.Author, 17) diff --git a/pkg/gui/presentation/remote_branches.go b/pkg/gui/presentation/remote_branches.go index 3c36a9e84..d8439acfe 100644 --- a/pkg/gui/presentation/remote_branches.go +++ b/pkg/gui/presentation/remote_branches.go @@ -18,10 +18,10 @@ func GetRemoteBranchListDisplayStrings(branches []*models.RemoteBranch, diffName // getRemoteBranchDisplayStrings returns the display string of branch func getRemoteBranchDisplayStrings(b *models.RemoteBranch, diffed bool) []string { - nameColorAttr := GetBranchColor(b.Name) + textStyle := GetBranchTextStyle(b.Name) if diffed { - nameColorAttr = theme.DiffTerminalColor + textStyle = theme.DiffTerminalColor } - return []string{nameColorAttr.Sprint(b.Name)} + return []string{textStyle.Sprint(b.Name)} } diff --git a/pkg/gui/presentation/remotes.go b/pkg/gui/presentation/remotes.go index 6c094ecfd..a1e50fe2f 100644 --- a/pkg/gui/presentation/remotes.go +++ b/pkg/gui/presentation/remotes.go @@ -21,10 +21,10 @@ func GetRemoteListDisplayStrings(remotes []*models.Remote, diffName string) [][] func getRemoteDisplayStrings(r *models.Remote, diffed bool) []string { branchCount := len(r.Branches) - nameColorAttr := theme.DefaultTextColor + textStyle := theme.DefaultTextColor if diffed { - nameColorAttr = theme.DiffTerminalColor + textStyle = theme.DiffTerminalColor } - return []string{nameColorAttr.Sprint(r.Name), style.FgBlue.Sprintf("%d branches", branchCount)} + return []string{textStyle.Sprint(r.Name), style.FgBlue.Sprintf("%d branches", branchCount)} } diff --git a/pkg/gui/presentation/stash_entries.go b/pkg/gui/presentation/stash_entries.go index 8ba6d5afb..f15b35a9c 100644 --- a/pkg/gui/presentation/stash_entries.go +++ b/pkg/gui/presentation/stash_entries.go @@ -18,9 +18,9 @@ func GetStashEntryListDisplayStrings(stashEntries []*models.StashEntry, diffName // getStashEntryDisplayStrings returns the display string of branch func getStashEntryDisplayStrings(s *models.StashEntry, diffed bool) []string { - attr := theme.DefaultTextColor + textStyle := theme.DefaultTextColor if diffed { - attr = theme.DiffTerminalColor + textStyle = theme.DiffTerminalColor } - return []string{attr.Sprint(s.Name)} + return []string{textStyle.Sprint(s.Name)} } diff --git a/pkg/gui/presentation/tags.go b/pkg/gui/presentation/tags.go index 529e34608..4754c4bef 100644 --- a/pkg/gui/presentation/tags.go +++ b/pkg/gui/presentation/tags.go @@ -18,9 +18,9 @@ func GetTagListDisplayStrings(tags []*models.Tag, diffName string) [][]string { // getTagDisplayStrings returns the display string of branch func getTagDisplayStrings(t *models.Tag, diffed bool) []string { - attr := theme.DefaultTextColor + textStyle := theme.DefaultTextColor if diffed { - attr = theme.DiffTerminalColor + textStyle = theme.DiffTerminalColor } - return []string{attr.Sprint(t.Name)} + return []string{textStyle.Sprint(t.Name)} } diff --git a/pkg/gui/status_panel.go b/pkg/gui/status_panel.go index d936b3bd8..a3f8deb10 100644 --- a/pkg/gui/status_panel.go +++ b/pkg/gui/status_panel.go @@ -31,7 +31,7 @@ func (gui *Gui) refreshStatus() { status += style.FgYellow.Sprintf("(%s) ", gui.GitCommand.WorkingTreeState()) } - name := presentation.GetBranchColor(currentBranch.Name).Sprint(currentBranch.Name) + name := presentation.GetBranchTextStyle(currentBranch.Name).Sprint(currentBranch.Name) repoName := utils.GetCurrentRepoName() status += fmt.Sprintf("%s → %s ", repoName, name) |