3c08053c57
Bugfixes: - Fixes a bug which placed the tree dots (…) for overflown list on the wrong position. Refactoring - Renamed `TextRender` to `TextRenderer` - Renamed `NoopRenderer` to `PlainRenderer` - Renamed `NoopRendererFactory` to `PlainRendererFactory`
60 lines
1.1 KiB
Go
60 lines
1.1 KiB
Go
// +build ignore
|
|
|
|
package main
|
|
|
|
import "github.com/gizak/termui"
|
|
import "github.com/nsf/termbox-go"
|
|
|
|
func commonList() *termui.List {
|
|
strs := []string{
|
|
"[0] github.com/gizak/termui",
|
|
"[1] 笀耔 [澉 灊灅甗](RED) 郔镺 笀耔 澉 [灊灅甗](yellow) 郔镺",
|
|
"[2] こんにちは世界",
|
|
"[3] keyboard.go",
|
|
"[4] [output](RED).go",
|
|
"[5] random_out.go",
|
|
"[6] [dashboard](BOLD).go",
|
|
"[7] nsf/termbox-go",
|
|
"[8] OVERFLOW!!!!!!![!!!!!!!!!!!!](red,bold)!!!"}
|
|
|
|
list := termui.NewList()
|
|
list.Items = strs
|
|
list.Height = 15
|
|
list.Width = 26
|
|
list.RendererFactory = termui.MarkdownTextRendererFactory{}
|
|
|
|
return list
|
|
}
|
|
|
|
func listHidden() *termui.List {
|
|
list := commonList()
|
|
list.Border.Label = "List - Hidden"
|
|
list.Overflow = "hidden"
|
|
|
|
return list
|
|
}
|
|
|
|
func listWrap() *termui.List {
|
|
list := commonList()
|
|
list.Border.Label = "List - Wrapped"
|
|
list.Overflow = "wrap"
|
|
|
|
return list
|
|
}
|
|
|
|
func main() {
|
|
err := termui.Init()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
defer termui.Close()
|
|
|
|
hiddenList := listHidden()
|
|
wrappedList := listWrap()
|
|
wrappedList.X = 30
|
|
|
|
termui.UseTheme("helloworld")
|
|
termui.Render(hiddenList, wrappedList)
|
|
termbox.PollEvent()
|
|
}
|