Skip to content

Commit

Permalink
fix: always render horizontal border edge when enabled (#211)
Browse files Browse the repository at this point in the history
When a style has a border set and an empty string is rendered, it should
still render the border. When the left border is set, width is
incremented by 1, so in most cases the width will not be 0.

When we render an empty string, with a double border and no left border
we expect the following:
╗
║
╝
But if we don't render a horizontal edge when the string width is less
than 1 we see this:

║

The string width can't be lower than 0, so we can safely remove the
(width < 1) check to create the expected behavior.

Co-authored-by: Daan Schoone <daaschoone@gmail.com>
  • Loading branch information
UnseenBook and Daan Schoone committed Mar 14, 2024
1 parent 552cd72 commit 9679562
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions borders.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,6 @@ func (s Style) applyBorder(str string) string {

// Render the horizontal (top or bottom) portion of a border.
func renderHorizontalEdge(left, middle, right string, width int) string {
if width < 1 {
return ""
}

if middle == "" {
middle = " "
}
Expand Down

0 comments on commit 9679562

Please sign in to comment.