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().
This commit is contained in:
Julian Prein authored and Junegunn Choi committed 2024-12-12 13:53:08 +09:00
1 parent 66dbee10f5
commit cdf641fa3e
2 files changed
+39 -65

No files matched your search

+8
View File
@@ -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