summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-05-15 20:43:16 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-05-15 21:12:12 +1000
commit913f17ee3e2c74dac354005d0ee446ae4a6eab52 (patch)
treece8e7c922e757c339d5737c963b0bee0bceea365
parent6291c539663b8646a3c09bc6e94c3a088abd7b39 (diff)
prevent flicker from bolding background of selected line
-rw-r--r--docs/Config.md8
-rw-r--r--pkg/commands/patch_parser.go2
-rw-r--r--pkg/config/app_config.go4
-rw-r--r--pkg/gui/merge_panel.go2
-rw-r--r--pkg/theme/theme.go4
5 files changed, 15 insertions, 5 deletions
diff --git a/docs/Config.md b/docs/Config.md
index 3685126cd..3b3350ec0 100644
--- a/docs/Config.md
+++ b/docs/Config.md
@@ -24,7 +24,9 @@ Default path for the config file:
optionsTextColor:
- blue
selectedLineBgColor:
- - bold
+ - default
+ selectedRangeBgColor:
+ - blue
commitLength:
show: true
mouseEvents: true
@@ -216,7 +218,7 @@ If you have issues with a light terminal theme where you can't read / see the te
inactiveBorderColor:
- black
selectedLineBgColor:
- - bold
+ - default
```
## Struggling to see selected line
@@ -228,6 +230,8 @@ If you struggle to see the selected line I recomment using the reverse attribute
theme:
selectedLineBgColor:
- reverse
+ selectedRangeBgColor:
+ - reverse
```
## Example Coloring
diff --git a/pkg/commands/patch_parser.go b/pkg/commands/patch_parser.go
index eb74e2f5b..d35aebb24 100644
--- a/pkg/commands/patch_parser.go
+++ b/pkg/commands/patch_parser.go
@@ -120,7 +120,7 @@ func coloredString(colorAttr color.Attribute, str string, selected bool, include
var cl *color.Color
attributes := []color.Attribute{colorAttr}
if selected {
- attributes = append(attributes, theme.SelectedLineBgColor)
+ attributes = append(attributes, theme.SelectedRangeBgColor)
}
cl = color.New(attributes...)
var clIncluded *color.Color
diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go
index 7d1648b6f..9938113d7 100644
--- a/pkg/config/app_config.go
+++ b/pkg/config/app_config.go
@@ -256,7 +256,9 @@ func GetDefaultConfig() []byte {
optionsTextColor:
- blue
selectedLineBgColor:
- - bold
+ - default
+ selectedRangeBgColor:
+ - blue
commitLength:
show: true
git:
diff --git a/pkg/gui/merge_panel.go b/pkg/gui/merge_panel.go
index d30f152ac..7d2e8fc52 100644
--- a/pkg/gui/merge_panel.go
+++ b/pkg/gui/merge_panel.go
@@ -59,7 +59,7 @@ func (gui *Gui) coloredConflictFile(content string, conflicts []commands.Conflic
colour := color.New(colourAttr)
if hasFocus && conflictIndex < len(conflicts) && conflicts[conflictIndex] == conflict && gui.shouldHighlightLine(i, conflict, conflictTop) {
colour.Add(color.Bold)
- colour.Add(theme.SelectedLineBgColor)
+ colour.Add(theme.SelectedRangeBgColor)
}
if i == conflict.End && len(remainingConflicts) > 0 {
conflict, remainingConflicts = gui.shiftConflict(remainingConflicts)
diff --git a/pkg/theme/theme.go b/pkg/theme/theme.go
index 259edfe04..0c85da775 100644
--- a/pkg/theme/theme.go
+++ b/pkg/theme/theme.go
@@ -24,6 +24,9 @@ var (
// SelectedLineBgColor is the background color for the selected line
SelectedLineBgColor color.Attribute
+ // SelectedRangeBgColor is the background color of the selected range of lines
+ SelectedRangeBgColor color.Attribute
+
// GocuiSelectedLineBgColor is the background color for the selected line in gocui
GocuiSelectedLineBgColor gocui.Attribute
@@ -39,6 +42,7 @@ func UpdateTheme(userConfig *viper.Viper) {
ActiveBorderColor = GetGocuiColor(userConfig.GetStringSlice("gui.theme.activeBorderColor"))
InactiveBorderColor = GetGocuiColor(userConfig.GetStringSlice("gui.theme.inactiveBorderColor"))
SelectedLineBgColor = GetBgColor(userConfig.GetStringSlice("gui.theme.selectedLineBgColor"))
+ SelectedRangeBgColor = GetBgColor(userConfig.GetStringSlice("gui.theme.selectedRangeBgColor"))
GocuiSelectedLineBgColor = GetGocuiColor(userConfig.GetStringSlice("gui.theme.selectedLineBgColor"))
OptionsColor = GetGocuiColor(userConfig.GetStringSlice("gui.theme.optionsTextColor"))
OptionsFgColor = GetFgColor(userConfig.GetStringSlice("gui.theme.optionsTextColor"))