From cdf641fa3ef266fee7217bf01513e5f942adb340 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Sat, 9 Nov 2024 18:12:17 +0100 Subject: Use Has{Top,Right,Bottom,Left}() where possible De-duplicate code and reduce the amount of code that has to be changed when new BorderShapes are being added. This also adds and uses the missing HasBottom(). --- src/tui/tui.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/tui') diff --git a/src/tui/tui.go b/src/tui/tui.go index 240f7ce7..e7d3e42f 100644 --- a/src/tui/tui.go +++ b/src/tui/tui.go @@ -387,6 +387,14 @@ func (s BorderShape) HasTop() bool { return true } +func (s BorderShape) HasBottom() bool { + switch s { + case BorderNone, BorderLeft, BorderRight, BorderTop, BorderVertical: // No bottom + return false + } + return true +} + type BorderStyle struct { shape BorderShape top rune -- cgit v1.2.3