summaryrefslogtreecommitdiffstats
path: root/pkg/commands
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-08-01 16:02:49 +1000
committerJesse Duffield <jessedduffield@gmail.com>2021-08-01 16:14:56 +1000
commitd626bcac0029267d3f45223198902f5cb78d9dc1 (patch)
tree684b0bd2cb23d4fac8dc7a53a28e2fd83c314abd /pkg/commands
parent123d624141ca73b828bdd6c6b43ff16ce1ec0e49 (diff)
color fixups
Diffstat (limited to 'pkg/commands')
-rw-r--r--pkg/commands/patch/patch_parser.go13
1 files changed, 7 insertions, 6 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) {