summaryrefslogtreecommitdiffstats
path: root/vendor/github.com
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2024-06-16 18:09:21 +0200
committerStefan Haller <stefan@haller-berlin.de>2024-06-23 14:43:13 +0200
commitdb0a1586d99393cda79e6022f3b3b8b4138b0e8b (patch)
tree9ace69f07c9770c698fce4eeccde3385a7c03348 /vendor/github.com
parent4e441127f399bf3865f1f16732977349b46bcd86 (diff)
Highlight inactive selection in bold
An inactive selection is one where the view is part of the context stack, but not the active view. For example, the files view when you enter the staging panel, or any view when you open a panel.
Diffstat (limited to 'vendor/github.com')
-rw-r--r--vendor/github.com/jesseduffield/gocui/view.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/vendor/github.com/jesseduffield/gocui/view.go b/vendor/github.com/jesseduffield/gocui/view.go
index a32519b80..6589c6981 100644
--- a/vendor/github.com/jesseduffield/gocui/view.go
+++ b/vendor/github.com/jesseduffield/gocui/view.go
@@ -81,6 +81,11 @@ type View struct {
// foreground colors of the selected line, when it is highlighted.
SelBgColor, SelFgColor Attribute
+ // InactiveViewSelBgColor is used to configure the background color of the
+ // selected line, when it is highlighted but the view doesn't have the
+ // focus.
+ InactiveViewSelBgColor Attribute
+
// If Editable is true, keystrokes will be added to the view's internal
// buffer at the cursor position.
Editable bool
@@ -96,6 +101,9 @@ type View struct {
// If Highlight is true, Sel{Bg,Fg}Colors will be used
// for the line under the cursor position.
Highlight bool
+ // If HighlightInactive is true, InavtiveViewSel{Bg,Fg}Colors will be used
+ // instead of Sel{Bg,Fg}Colors for highlighting selected lines.
+ HighlightInactive bool
// If Frame is true, a border will be drawn around the view.
Frame bool
@@ -404,6 +412,7 @@ func newView(name string, x0, y0, x1, y1 int, mode OutputMode) *View {
v.FgColor, v.BgColor = ColorDefault, ColorDefault
v.SelFgColor, v.SelBgColor = ColorDefault, ColorDefault
+ v.InactiveViewSelBgColor = ColorDefault
v.TitleColor, v.FrameColor = ColorDefault, ColorDefault
return v
}
@@ -506,7 +515,11 @@ func (v *View) setRune(x, y int, ch rune, fgColor, bgColor Attribute) error {
fgColor += 8
}
fgColor = fgColor | AttrBold
- bgColor = bgColor | v.SelBgColor
+ if v.HighlightInactive {
+ bgColor = bgColor | v.InactiveViewSelBgColor
+ } else {
+ bgColor = bgColor | v.SelBgColor
+ }
}
}