[GH-ISSUE #119] Question: Is there a way to set a fixed width to table columns? #91

Closed
opened 2026-03-04 01:01:52 +03:00 by kerem · 2 comments
Owner

Originally created by @3cb on GitHub (May 22, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/119

I'm trying to use tview to display streaming price data from websockets in a table and the text strings have variable length which makes the columns shift back and forth when I update and redraw the table. Is there a way to fix this without manually adding empty spaces to the text strings on each update?

Apologies if I have missed it in the documentation.

Originally created by @3cb on GitHub (May 22, 2018). Original GitHub issue: https://github.com/rivo/tview/issues/119 I'm trying to use tview to display streaming price data from websockets in a table and the text strings have variable length which makes the columns shift back and forth when I update and redraw the table. Is there a way to fix this without manually adding empty spaces to the text strings on each update? Apologies if I have missed it in the documentation.
kerem closed this issue 2026-03-04 01:01:52 +03:00
Author
Owner

@rivo commented on GitHub (May 23, 2018):

You haven't missed it. There's no fixed width parameter for table columns at the moment. I know this is what you're trying to avoid but you could do the following to pad your strings:

cell.SetText(fmt.Sprintf("%-10s",mystr))
<!-- gh-comment-id:391289632 --> @rivo commented on GitHub (May 23, 2018): You haven't missed it. There's no fixed width parameter for table columns at the moment. I know this is what you're trying to avoid but you could do the following to pad your strings: ```go cell.SetText(fmt.Sprintf("%-10s",mystr)) ```
Author
Owner

@3cb commented on GitHub (May 23, 2018):

Thanks for the info and the library.

<!-- gh-comment-id:391395231 --> @3cb commented on GitHub (May 23, 2018): Thanks for the info and the library.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#91
No description provided.