summaryrefslogtreecommitdiff
path: root/src/tui/light.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-01-05 23:02:52 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-01-05 23:02:52 +0900
commita5beb08ed72215e8b015851ad70bf3beca526429 (patch)
tree8b469e7210224defe03290878f5473f2cb8e3ce1 /src/tui/light.go
parent45fc7b903d1aab0871f03cbe1c4fbec71b932d9f (diff)
downloadfzf-a5beb08ed72215e8b015851ad70bf3beca526429.tar.gz
Border around the header section
Close #4159
Diffstat (limited to 'src/tui/light.go')
-rw-r--r--src/tui/light.go20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/tui/light.go b/src/tui/light.go
index 3cb1a8bc..48202bce 100644
--- a/src/tui/light.go
+++ b/src/tui/light.go
@@ -804,6 +804,9 @@ func (r *LightRenderer) NewWindow(top int, left int, width int, height int, wind
case WindowInput:
w.fg = r.theme.Input.Color
w.bg = r.theme.InputBg.Color
+ case WindowHeader:
+ w.fg = r.theme.Header.Color
+ w.bg = r.theme.HeaderBg.Color
case WindowPreview:
w.fg = r.theme.PreviewFg.Color
w.bg = r.theme.PreviewBg.Color
@@ -862,6 +865,8 @@ func (w *LightWindow) drawBorderHorizontal(top, bottom bool) {
color = ColListBorder
case WindowInput:
color = ColInputBorder
+ case WindowHeader:
+ color = ColHeaderBorder
case WindowPreview:
color = ColPreviewBorder
}
@@ -885,6 +890,8 @@ func (w *LightWindow) drawBorderVertical(left, right bool) {
color = ColListBorder
case WindowInput:
color = ColInputBorder
+ case WindowHeader:
+ color = ColHeaderBorder
case WindowPreview:
color = ColPreviewBorder
}
@@ -910,6 +917,8 @@ func (w *LightWindow) drawBorderAround(onlyHorizontal bool) {
color = ColListBorder
case WindowInput:
color = ColInputBorder
+ case WindowHeader:
+ color = ColHeaderBorder
case WindowPreview:
color = ColPreviewBorder
}
@@ -970,9 +979,16 @@ func (w *LightWindow) Y() int {
return w.posy
}
+func (w *LightWindow) EncloseX(x int) bool {
+ return x >= w.left && x < (w.left+w.width)
+}
+
+func (w *LightWindow) EncloseY(y int) bool {
+ return y >= w.top && y < (w.top+w.height)
+}
+
func (w *LightWindow) Enclose(y int, x int) bool {
- return x >= w.left && x < (w.left+w.width) &&
- y >= w.top && y < (w.top+w.height)
+ return w.EncloseX(x) && w.EncloseY(y)
}
func (w *LightWindow) Move(y int, x int) {