summaryrefslogtreecommitdiffstats
path: root/src/tui/light.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2020-10-26 22:33:41 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2020-10-26 22:51:22 +0900
commit2e8e63fb0b3b62e89472eebe9e86578598e1a541 (patch)
tree8c10978de92b685df67ae4624e13daddbf65c711 /src/tui/light.go
parent874f7dd416a4098d657dce7f307b60485993eea1 (diff)
Add more --border options
Instead of drawing the window border in Vim using an extra window, extend the --border option so that we do can it natively. Close #2223 Fix #2184
Diffstat (limited to 'src/tui/light.go')
-rw-r--r--src/tui/light.go43
1 files changed, 37 insertions, 6 deletions
diff --git a/src/tui/light.go b/src/tui/light.go
index 6bd08216..ad536f6d 100644
--- a/src/tui/light.go
+++ b/src/tui/light.go
@@ -653,15 +653,46 @@ func (w *LightWindow) drawBorder() {
case BorderRounded, BorderSharp:
w.drawBorderAround()
case BorderHorizontal:
- w.drawBorderHorizontal()
+ w.drawBorderHorizontal(true, true)
+ case BorderVertical:
+ w.drawBorderVertical(true, true)
+ case BorderTop:
+ w.drawBorderHorizontal(true, false)
+ case BorderBottom:
+ w.drawBorderHorizontal(false, true)
+ case BorderLeft:
+ w.drawBorderVertical(true, false)
+ case BorderRight:
+ w.drawBorderVertical(false, true)
}
}
-func (w *LightWindow) drawBorderHorizontal() {
- w.Move(0, 0)
- w.CPrint(ColBorder, repeat(w.border.horizontal, w.width))
- w.Move(w.height-1, 0)
- w.CPrint(ColBorder, repeat(w.border.horizontal, w.width))
+func (w *LightWindow) drawBorderHorizontal(top, bottom bool) {
+ if top {
+ w.Move(0, 0)
+ w.CPrint(ColBorder, repeat(w.border.horizontal, w.width))
+ }
+ if bottom {
+ w.Move(w.height-1, 0)
+ w.CPrint(ColBorder, repeat(w.border.horizontal, w.width))
+ }
+}
+
+func (w *LightWindow) drawBorderVertical(left, right bool) {
+ width := w.width - 2
+ if !left || !right {
+ width++
+ }
+ for y := 0; y < w.height; y++ {
+ w.Move(y, 0)
+ if left {
+ w.CPrint(ColBorder, string(w.border.vertical))
+ }
+ w.CPrint(ColBorder, repeat(' ', width))
+ if right {
+ w.CPrint(ColBorder, string(w.border.vertical))
+ }
+ }
}
func (w *LightWindow) drawBorderAround() {