diff options
author | Mike <10135646+mikesmithgh@users.noreply.github.com> | 2023-06-10 01:48:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-10 14:48:29 +0900 |
commit | ce8a745fb4ea6d0725e76d13d97fdf4b7433331d (patch) | |
tree | 5f8143c23c41a68c47bcb17c6a51b401ad35cefe /src/tui | |
parent | 3e9efd1401404da8afdcf9757ac9996f5c48290f (diff) |
Add new border style: 'thinblock' (#3327)
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
Diffstat (limited to 'src/tui')
-rw-r--r-- | src/tui/light.go | 2 | ||||
-rw-r--r-- | src/tui/tcell.go | 10 | ||||
-rw-r--r-- | src/tui/tui.go | 18 |
3 files changed, 24 insertions, 6 deletions
diff --git a/src/tui/light.go b/src/tui/light.go index 8356eb50..cff59c90 100644 --- a/src/tui/light.go +++ b/src/tui/light.go @@ -757,7 +757,7 @@ func (w *LightWindow) DrawHBorder() { func (w *LightWindow) drawBorder(onlyHorizontal bool) { switch w.border.shape { - case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderDouble: + case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderThinBlock, BorderDouble: w.drawBorderAround(onlyHorizontal) case BorderHorizontal: w.drawBorderHorizontal(true, true) diff --git a/src/tui/tcell.go b/src/tui/tcell.go index f815df07..8f6806d4 100644 --- a/src/tui/tcell.go +++ b/src/tui/tcell.go @@ -715,7 +715,7 @@ func (w *TcellWindow) drawBorder(onlyHorizontal bool) { hw := runewidth.RuneWidth(w.borderStyle.top) switch shape { - case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderDouble, BorderHorizontal, BorderTop: + case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderThinBlock, BorderDouble, BorderHorizontal, BorderTop: max := right - 2*hw if shape == BorderHorizontal || shape == BorderTop { max = right - hw @@ -730,7 +730,7 @@ func (w *TcellWindow) drawBorder(onlyHorizontal bool) { } } switch shape { - case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderDouble, BorderHorizontal, BorderBottom: + case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderThinBlock, BorderDouble, BorderHorizontal, BorderBottom: max := right - 2*hw if shape == BorderHorizontal || shape == BorderBottom { max = right - hw @@ -741,13 +741,13 @@ func (w *TcellWindow) drawBorder(onlyHorizontal bool) { } if !onlyHorizontal { switch shape { - case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderDouble, BorderVertical, BorderLeft: + case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderThinBlock, BorderDouble, BorderVertical, BorderLeft: for y := top; y < bot; y++ { _screen.SetContent(left, y, w.borderStyle.left, nil, style) } } switch shape { - case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderDouble, BorderVertical, BorderRight: + case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderThinBlock, BorderDouble, BorderVertical, BorderRight: vw := runewidth.RuneWidth(w.borderStyle.right) for y := top; y < bot; y++ { _screen.SetContent(right-vw, y, w.borderStyle.right, nil, style) @@ -755,7 +755,7 @@ func (w *TcellWindow) drawBorder(onlyHorizontal bool) { } } switch shape { - case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderDouble: + case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderThinBlock, BorderDouble: _screen.SetContent(left, top, w.borderStyle.topLeft, nil, style) _screen.SetContent(right-runewidth.RuneWidth(w.borderStyle.topRight), top, w.borderStyle.topRight, nil, style) _screen.SetContent(left, bot-1, w.borderStyle.bottomLeft, nil, style) diff --git a/src/tui/tui.go b/src/tui/tui.go index 55fbe771..8cfe8d33 100644 --- a/src/tui/tui.go +++ b/src/tui/tui.go @@ -315,6 +315,7 @@ const ( BorderSharp BorderBold BorderBlock + BorderThinBlock BorderDouble BorderHorizontal BorderVertical @@ -408,6 +409,23 @@ func MakeBorderStyle(shape BorderShape, unicode bool) BorderStyle { bottomLeft: '▙', bottomRight: '▟', } + + case BorderThinBlock: + // 🭽▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔🭾 + // ▏ ▕ + // 🭼▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁🭿 + return BorderStyle{ + shape: shape, + top: '▔', + bottom: '▁', + left: '▏', + right: '▕', + topLeft: '🭽', + topRight: '🭾', + bottomLeft: '🭼', + bottomRight: '🭿', + } + case BorderDouble: return BorderStyle{ shape: shape, |