mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #109] Add support for ASCII trees #85
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#85
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 @dastergon on GitHub (May 4, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/109
It would be great if there was a widget that wraps the treeprint package and allows nested lists in a tree-like form that can be traversable from the keyboard. Bonus: The ascii tree can have the ability to collapse/shrink the sub-lists.
Example:
@rivo commented on GitHub (May 4, 2018):
This doesn't seem too difficult to do. The
treeprintpackage appears to give you a string with the tree in it which you could easily write to aTextView(e.g. usingtextView.SetText()).Using
TextViewregions, you could highlight each item and in combination withSetInputCapture(), you could implement collapse/expand functionality.I don't see this as a standard class in
tviewbut it doesn't look hard to connect the two packages. So if you need it in your own application, it shouldn't be too much of an effort.@dastergon commented on GitHub (May 4, 2018):
Hi @rivo,
Thanks for the clarifications, I will attempt to implement this myself. Does TextView support pagination for large texts? Also, is search feasible within the TextView?
@dastergon commented on GitHub (May 6, 2018):
Hi @rivo,
Is there a way to capture the value of a region? Example:
["0"]foobar[""]. I would like to perform an action on the specific name when I move to that region.@rivo commented on GitHub (May 8, 2018):
GetRegionText()should do what you're looking for.For a list of currently highlighted regions, see
GetHighlights().@dastergon commented on GitHub (May 9, 2018):
Hi @rivo, I checked those functions, but I am unable to work with nested regions
["0a"]["0b"]something[""]. GetHighlights() only recognises the latter["0b"]. Did I miss anything, or should I open an issue for that?@rivo commented on GitHub (May 12, 2018):
I'm not sure I understand exactly what you are expecting. Regions are not nested. If you start a new region, it automatically ends the previous region. And the special
[""]only ends the current region, without starting a new one.Does this clarify it?