mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #376] TreeView: method to wrap entries or get minimal width #279
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#279
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @problame on GitHub (Dec 10, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/376
I have a
FlexwithTreeView | DetailView.The
TreeView's entry titles have variable sizes unknown at the time the TreeView is added to theFlex.I want to resize the
TreeViewto an ideal fixed width such that the entry titles are shown completely.Flex.ResizeItemallows resizing, but there is no way to get the ideal width fromTreeView, i.e., after it added all indents, etc.What is the best way to accomplish this?
@rivo commented on GitHub (Dec 29, 2019):
The package currently does not provide methods to calculate such a width.
tview's layout is top-down so you have to know yourself how much space you give each element in aFlex.Probably the best way is to determine the depth of your item (times the number of characters
tviewadds per branch) plus the width of your text (using something likerunewidth.StringWidth()). For multiple items, you'll need to use the maximum over these widths.Let me know if this helps you in any way.
@rivo commented on GitHub (Feb 19, 2020):
Will reopen if this turns out not to be resolved.