[GH-ISSUE #227] Feature request: add columns of fixed width #173

Closed
opened 2026-03-04 01:02:37 +03:00 by kerem · 4 comments
Owner

Originally created by @Sacules on GitHub (Jan 18, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/227

Hello, I'm loving tview and using it to build a small music tagger. I'd like to ask something similar to #119: I have a table of content and I'd like to assign a fixed width to each column (with the possibility of resizing them on the fly), and wrapping the text that doesn't fit, or displaying "..." at the end of it.

Originally created by @Sacules on GitHub (Jan 18, 2019). Original GitHub issue: https://github.com/rivo/tview/issues/227 Hello, I'm loving tview and using it to build a small [music tagger](https://gitlab.com/Sacules/index). I'd like to ask something similar to #119: I have a table of content and I'd like to assign a fixed width to each column (with the possibility of resizing them on the fly), and wrapping the text that doesn't fit, or displaying "..." at the end of it.
kerem closed this issue 2026-03-04 01:02:37 +03:00
Author
Owner

@dguendisch commented on GitHub (Jan 18, 2019):

That's at least possible on cell level, see https://github.com/rivo/tview/blob/master/table.go#L74
Just give all your cells in a column the respective maxWidth and tview will append a nice for every cell text exceeding the maxWidth, effectively limiting your column width.
Haven't seen a way though on how to specify this on a table or column level (instead of every single cell), but haven't looked deeply for such.

<!-- gh-comment-id:455518953 --> @dguendisch commented on GitHub (Jan 18, 2019): That's at least possible on cell level, see https://github.com/rivo/tview/blob/master/table.go#L74 Just give all your cells in a column the respective maxWidth and tview will append a nice `…` for every cell text exceeding the maxWidth, effectively limiting your column width. Haven't seen a way though on how to specify this on a table or column level (instead of every single cell), but haven't looked deeply for such.
Author
Owner

@rivo commented on GitHub (Jan 22, 2019):

Thanks to @dguendisch for providing the correct answer here.

@Sacules, let us know if this solves your problem.

<!-- gh-comment-id:456406300 --> @rivo commented on GitHub (Jan 22, 2019): Thanks to @dguendisch for providing the correct answer here. @Sacules, let us know if this solves your problem.
Author
Owner

@Sacules commented on GitHub (Feb 2, 2019):

Yeah it works by now, thanks!

<!-- gh-comment-id:459941634 --> @Sacules commented on GitHub (Feb 2, 2019): Yeah it works by now, thanks!
Author
Owner

@jsumners-nr commented on GitHub (Oct 16, 2024):

For those looking at this in the future, the static link is github.com/rivo/tview@e5e361b9d7/table.go (L74)

<!-- gh-comment-id:2417826500 --> @jsumners-nr commented on GitHub (Oct 16, 2024): For those looking at this in the future, the static link is https://github.com/rivo/tview/blob/e5e361b9d7908c94aa426e31c208e2c69df0d95d/table.go#L74
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#173
No description provided.