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

How to get the table rows? #191

Open
WestleyK opened this issue Aug 10, 2021 · 1 comment · May be fixed by #192
Open

How to get the table rows? #191

WestleyK opened this issue Aug 10, 2021 · 1 comment · May be fixed by #192

Comments

@WestleyK
Copy link

WestleyK commented Aug 10, 2021

It would be nice to have a function like:

rows := table.Rows()
fmt.Printf("ROWS=%d\n", rows) // prints the number of rows in the table (including any newlines that the table adds)

I need this function because I have my table rewrite itself, and I need to set the cursor to the correct height, otherwise it wont update correctly.

I can manually count the rows when I append data, but this will only work if the table does not automatically add newlines (and I want the newlines).

EDIT: I see that there is NumLines(), but that does not account for the newlines that the table automatically puts there.

WestleyK pushed a commit to WestleyK/tablewriter that referenced this issue Aug 12, 2021
Silthus pushed a commit to Silthus/tablewriter that referenced this issue Aug 12, 2022
@olekukonko
Copy link
Owner

are you saying the number of new lines is not predictable?

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

Successfully merging a pull request may close this issue.

2 participants