From 2a75e404af43ca8fa6e707d4506b41dad0ba1b83 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Fri, 10 May 2024 15:12:40 -0400 Subject: unicode support --- gui/widget/tree.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gui/widget/tree.go') 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 { -- cgit v1.2.3