From 49350e374a6b0007ced8ccd7fc949160a19d84ed Mon Sep 17 00:00:00 2001 From: ajcarvajal Date: Sat, 29 Jun 2019 18:03:04 -0800 Subject: [PATCH 1/3] make textview1 example sleep when inactive --- demos/presentation/textview.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/demos/presentation/textview.go b/demos/presentation/textview.go index 666dfe7..a6a50d3 100644 --- a/demos/presentation/textview.go +++ b/demos/presentation/textview.go @@ -45,9 +45,13 @@ func TextView1(nextSlide func()) (title string, content tview.Primitive) { go func() { var n int for { - n++ - fmt.Fprintf(textView, "%d ", n) - time.Sleep(200 * time.Millisecond) + if textView.HasFocus() { + n++ + fmt.Fprintf(textView, "%d ", n) + time.Sleep(200 * time.Millisecond) + } else { + time.Sleep(time.Second) + } } }() textView.SetBorder(true).SetTitle("TextView implements io.Writer") From e4b4b7fe823043c55d9e0d98512552eed5d9b2d2 Mon Sep 17 00:00:00 2001 From: ajcarvajal Date: Sun, 30 Jun 2019 14:44:17 -0800 Subject: [PATCH 2/3] formatting fixes --- demos/presentation/treeview.go | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/demos/presentation/treeview.go b/demos/presentation/treeview.go index 68349cd..81d5422 100644 --- a/demos/presentation/treeview.go +++ b/demos/presentation/treeview.go @@ -74,7 +74,10 @@ var rootNode = &node{ {text: "Tree list starts one level down"}, {text: "Works better for lists where no top node is needed"}, {text: "Switch to this layout", selected: func() { - tree.SetAlign(false).SetTopLevel(1).SetGraphics(true).SetPrefixes(nil) + tree.SetAlign(false). + SetTopLevel(1). + SetGraphics(true). + SetPrefixes(nil) treeCode.SetText(strings.Replace(treeAllCode, "$$$", treeTopLevelCode, -1)) }}, }}, @@ -82,7 +85,10 @@ var rootNode = &node{ {text: "For trees that are similar to lists"}, {text: "Hierarchy shown only in line drawings"}, {text: "Switch to this layout", selected: func() { - tree.SetAlign(true).SetTopLevel(0).SetGraphics(true).SetPrefixes(nil) + tree.SetAlign(true). + SetTopLevel(0). + SetGraphics(true). + SetPrefixes(nil) treeCode.SetText(strings.Replace(treeAllCode, "$$$", treeAlignCode, -1)) }}, }}, @@ -90,7 +96,10 @@ var rootNode = &node{ {text: "Best for hierarchical bullet point lists"}, {text: "You can define your own prefixes per level"}, {text: "Switch to this layout", selected: func() { - tree.SetAlign(false).SetTopLevel(1).SetGraphics(false).SetPrefixes([]string{"[red]* ", "[darkcyan]- ", "[darkmagenta]- "}) + tree.SetAlign(false). + SetTopLevel(1). + SetGraphics(false). + SetPrefixes([]string{"[red]* ", "[darkcyan]- ", "[darkmagenta]- "}) treeCode.SetText(strings.Replace(treeAllCode, "$$$", treePrefixCode, -1)) }}, }}, @@ -98,7 +107,10 @@ var rootNode = &node{ {text: "Lines illustrate hierarchy"}, {text: "Basic indentation"}, {text: "Switch to this layout", selected: func() { - tree.SetAlign(false).SetTopLevel(0).SetGraphics(true).SetPrefixes(nil) + tree.SetAlign(false). + SetTopLevel(0). + SetGraphics(true). + SetPrefixes(nil) treeCode.SetText(strings.Replace(treeAllCode, "$$$", treeBasicCode, -1)) }}, }}, From 93e6a490c38a6d91193ae879b883173532ed479e Mon Sep 17 00:00:00 2001 From: ajcarvajal Date: Wed, 8 Jan 2020 09:43:49 -0500 Subject: [PATCH 3/3] Revert "formatting fixes" This reverts commit e4b4b7fe823043c55d9e0d98512552eed5d9b2d2. --- demos/presentation/treeview.go | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/demos/presentation/treeview.go b/demos/presentation/treeview.go index 81d5422..68349cd 100644 --- a/demos/presentation/treeview.go +++ b/demos/presentation/treeview.go @@ -74,10 +74,7 @@ var rootNode = &node{ {text: "Tree list starts one level down"}, {text: "Works better for lists where no top node is needed"}, {text: "Switch to this layout", selected: func() { - tree.SetAlign(false). - SetTopLevel(1). - SetGraphics(true). - SetPrefixes(nil) + tree.SetAlign(false).SetTopLevel(1).SetGraphics(true).SetPrefixes(nil) treeCode.SetText(strings.Replace(treeAllCode, "$$$", treeTopLevelCode, -1)) }}, }}, @@ -85,10 +82,7 @@ var rootNode = &node{ {text: "For trees that are similar to lists"}, {text: "Hierarchy shown only in line drawings"}, {text: "Switch to this layout", selected: func() { - tree.SetAlign(true). - SetTopLevel(0). - SetGraphics(true). - SetPrefixes(nil) + tree.SetAlign(true).SetTopLevel(0).SetGraphics(true).SetPrefixes(nil) treeCode.SetText(strings.Replace(treeAllCode, "$$$", treeAlignCode, -1)) }}, }}, @@ -96,10 +90,7 @@ var rootNode = &node{ {text: "Best for hierarchical bullet point lists"}, {text: "You can define your own prefixes per level"}, {text: "Switch to this layout", selected: func() { - tree.SetAlign(false). - SetTopLevel(1). - SetGraphics(false). - SetPrefixes([]string{"[red]* ", "[darkcyan]- ", "[darkmagenta]- "}) + tree.SetAlign(false).SetTopLevel(1).SetGraphics(false).SetPrefixes([]string{"[red]* ", "[darkcyan]- ", "[darkmagenta]- "}) treeCode.SetText(strings.Replace(treeAllCode, "$$$", treePrefixCode, -1)) }}, }}, @@ -107,10 +98,7 @@ var rootNode = &node{ {text: "Lines illustrate hierarchy"}, {text: "Basic indentation"}, {text: "Switch to this layout", selected: func() { - tree.SetAlign(false). - SetTopLevel(0). - SetGraphics(true). - SetPrefixes(nil) + tree.SetAlign(false).SetTopLevel(0).SetGraphics(true).SetPrefixes(nil) treeCode.SetText(strings.Replace(treeAllCode, "$$$", treeBasicCode, -1)) }}, }},