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

Table without border and header truncates last line #261

Open
testinfected opened this issue Feb 13, 2024 · 0 comments
Open

Table without border and header truncates last line #261

testinfected opened this issue Feb 13, 2024 · 0 comments

Comments

@testinfected
Copy link

testinfected commented Feb 13, 2024

Describe the bug
A table which as no border and no header will truncate its last line. In this case the table height is miscalculated.

Additional context
For instance a table with no header and a single line shows nothing.

func (t *Table) computeHeight() int {
	hasHeaders := t.headers != nil && len(t.headers) > 0
	return sum(t.heights) - 1 + btoi(hasHeaders) +
		btoi(t.borderTop) + btoi(t.borderBottom) +
		btoi(t.borderHeader) + t.data.Rows()*btoi(t.borderRow)
}

t.heights in this case is 1 so we end up with a total height of 0. It works with a header because the header height is accounted for twice: once in t.heights and once again with btoi(hasHeaders).
The -1 is the culprit here I guess

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

1 participant