aboutsummaryrefslogtreecommitdiffstats
path: root/gui/widget/tree.go
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2024-05-10 15:12:40 -0400
committerSam Anthony <sam@samanthony.xyz>2024-05-10 15:12:40 -0400
commit2a75e404af43ca8fa6e707d4506b41dad0ba1b83 (patch)
treef0eb127c39720302f2a496ccf0f01529dd749c3f /gui/widget/tree.go
parentf81e4a813766980c6e837893e19cc10bf6d7c41e (diff)
downloadvolute-2a75e404af43ca8fa6e707d4506b41dad0ba1b83.zip
unicode support
Diffstat (limited to 'gui/widget/tree.go')
-rw-r--r--gui/widget/tree.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/gui/widget/tree.go b/gui/widget/tree.go
index 14d7b9d..633d440 100644
--- a/gui/widget/tree.go
+++ b/gui/widget/tree.go
@@ -9,6 +9,8 @@ import (
"volute/gui/layout"
)
+const INDENT = 2
+
type Node[T any] struct {
Label string
Value T
@@ -50,7 +52,9 @@ func Tree[T any](trees []Node[T], r image.Rectangle, focus FocusSlave, mux *gui.
}
func flatten[T any](root Node[T], depth int) []string {
- indent := string(populate(make([]byte, 2*depth), ' '))
+ indent := string(populate(
+ make([]rune, INDENT*depth),
+ '─'))
nodes := []string{indent + root.Label}
root.expanded = true // TODO: remove me
if root.expanded {