Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TopRight and BottomRight border not showing when rendering an empty string and no left border #214

Open
UnseenBook opened this issue Aug 4, 2023 · 1 comment

Comments

@UnseenBook
Copy link
Contributor

Describe the bug
Rendering an empty string with a border style and no left border, it doesn't render the TopRight and BottomRight corders.
Using DoubleBorder you would expect it to look like this:

╗
║
╝

But it ends up looking like this:

Setup
Not applicable, but here you go:

  • OS: ArchLinux
  • Shell: Bash
  • Terminal Emulator: tilix
  • Locale: en_US.UTF-8

To Reproduce
Run the following:

package main

import (
	"fmt"
	"github.com/charmbracelet/lipgloss"
)

func main() {
	noLeftStyle := lipgloss.NewStyle().
		Border(lipgloss.DoubleBorder()).
		BorderLeft(false)
	fmt.Println(noLeftStyle.Render(""))
}

Solution
I submitted a PR to fix this: #211
Horizontal edges aren't rendered when width is 0, which doesn't take corners into consideration.
When the left border is enabled, width is incremented once, so with a left border enabled, width is never 0.

@zhangddjs
Copy link

Also I meet a bug here, while I set top border false, all border went missing.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants