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

A table with no outside border, but internal borders, does not render correctly #355

Open
SVendittelli opened this issue Aug 23, 2024 · 0 comments
Assignees

Comments

@SVendittelli
Copy link

Describe the bug
When rendering a table with no outside borders (i.e. top, bottom, left, and right are disabled) and internal borders enabled (i.e. row and column are enabled), the borders do not align correctly. Extra characters are rendered for the horizontal borders.

Setup
Please complete the following information along with version numbers, if applicable.

  • OS: Windows 11
  • Shell: PowerShell 7.4.4, git bash
  • Terminal Emulator: Alacritty, Windows Terminal, Git Bash
  • Terminal Multiplexer: N/A
  • Locale: en_GB.UTF-8

To Reproduce
Steps to reproduce the behavior:

  1. Create a new go module (mkdir table && cd table && go mod init table)
  2. Create a main.go with the contents below
  3. Run go get . to pull dependencies
  4. Run go run .
  5. Observe incorrect rendering:
1│2│3
├─┼─┼─┤
4│5│6
├─┼─┼─┤
7│8│9

Source Code
main.go

package main

import (
	"fmt"

	"github.com/charmbracelet/lipgloss"
	"github.com/charmbracelet/lipgloss/table"
)

func main() {

	board := [][]string{
		{"1", "2", "3"},
		{"4", "5", "6"},
		{"7", "8", "9"},
	}

	t := table.New().
		Border(lipgloss.NormalBorder()).
		BorderRow(true).
		BorderColumn(true).
		BorderTop(false).
		BorderBottom(false).
		BorderLeft(false).
		BorderRight(false).
		Rows(board...)

	fmt.Println(t.Render())
}

Expected behavior
The additional characters ( and ) would not be rendered, resulting in:

1│2│3
─┼─┼─
4│5│6
─┼─┼─
7│8│9

Screenshots
Screenshot 2024-08-23 170542

Additional context
This is inconsistent with the type of border, I have included a list of them all below:

BlockBorder:

1█2█3
███
4█5█6
███
7█8█9

DoubleBorder:

1║2║3
╠═╬═╬═╣
4║5║6
╠═╬═╬═╣
7║8║9

HiddenBorder:

1 2 3

4 5 6

7 8 9

InnerHalfBlockBorder:

1▐2▐3
▀▀▀
4▐5▐6
▀▀▀
7▐8▐9

NormalBorder:

1│2│3
├─┼─┼─┤
4│5│6
├─┼─┼─┤
7│8│9

OuterHalfBlockBorder:

1▌2▌3
▄▄▄
4▌5▌6
▄▄▄
7▌8▌9

RoundedBorder:

1│2│3
├─┼─┼─┤
4│5│6
├─┼─┼─┤
7│8│9

ThickBorder:

1┃2┃3
┣━╋━╋━┫
4┃5┃6
┣━╋━╋━┫
7┃8┃9
@bashbunni bashbunni self-assigned this Oct 9, 2024
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