1
0
mirror of https://github.com/mum4k/termdash.git synced 2025-04-25 13:48:50 +08:00

Changing termbox to tcell in all examples.

Jakub Sobon 2020-11-14 01:29:24 -05:00
parent ec6b860e01
commit 343c08a74e
No known key found for this signature in database
GPG Key ID: F2451A77FB05D3B7
8 changed files with 31 additions and 31 deletions

@ -26,7 +26,7 @@ The following code displays five bars with values 1 through 5 and the relative m
```go
func main() {
t, err := termbox.New()
t, err := tcell.New()
if err != nil {
panic(err)
}

@ -47,13 +47,13 @@ The **container.New** function is used to construct a container. The API of this
To create the terminal layout indicated in the diagram above, the developer can use the following code:
```go
tb, err := termbox.New()
t, err := tcell.New()
if err != nil {
return fmt.Errorf("termbox.New => %v", err)
return fmt.Errorf("tcell.New => %v", err)
}
if _, err := container.New(
tb,
t,
container.SplitVertical(
container.Left(
container.Border(linestyle.Light),

@ -11,11 +11,11 @@ Containers don't have any borders by default, use one of the following options t
The following code shows two containers with different border styles as shown above. The right container has the keyboard focus so its border is highlighted.
```go
tb, err := termbox.New()
t, err := tcell.New()
if err != nil {
panic(err)
}
defer tb.Close()
defer t.Close()
c, err := container.New(
t,
@ -54,11 +54,11 @@ Containers that have a border can also have a text title displayed in the border
The following code shows a container with a title in the border that is aligned to the right.
```go
tb, err := termbox.New()
t, err := tcell.New()
if err != nil {
panic(err)
}
defer tb.Close()
defer t.Close()
c, err := container.New(
t,

@ -29,11 +29,11 @@ The **Container.Update** method applies the specified options to a container wit
The following code places a button widget inside a container and then updates the container by replacing the button with a text widget:
```go
tb, err := termbox.New()
t, err := tcell.New()
if err != nil {
panic(err)
}
defer tb.Close()
defer t.Close()
b, err := button.New("hello world", func() error {
return nil
@ -69,11 +69,11 @@ When container is updated by adding a new split, any previously placed widgets o
The following code places a button widget inside a container and then updates the container by splitting it into two and placing a button and a text widget:
```go
tb, err := termbox.New()
t, err := tcell.New()
if err != nil {
panic(err)
}
defer tb.Close()
defer t.Close()
b, err := button.New("hello world", func() error {
return nil

@ -52,9 +52,9 @@ The **grid.New** function is used to construct a **grid.Builder** instance. The
To create the terminal layout indicated in the diagram above, the developer can use the following code:
```go
tb, err := termbox.New()
t, err := tcell.New()
if err != nil {
return fmt.Errorf("termbox.New => %v", err)
return fmt.Errorf("tcell.New => %v", err)
}
b, err := button.New("button", func() error {

@ -55,9 +55,9 @@ The **right** and **left** values are specified as percentage of the container's
The following code snippet demonstrates application and effect of margin and padding. The left container has both margin and padding applied. The right container has none of these options. Both containers contain a single button and have a border.
```go
t, err := termbox.New()
t, err := tcell.New()
if err != nil {
return fmt.Errorf("termbox.New => %v", err)
return fmt.Errorf("tcell.New => %v", err)
}
defer t.Close()

@ -22,11 +22,11 @@ The **container.PlaceWidget** option places the provided widget into the contain
The following code places a button widget inside a container as shown above:
```go
tb, err := termbox.New()
t, err := tcell.New()
if err != nil {
panic(err)
}
defer tb.Close()
defer t.Close()
b, err := button.New("hello world", func() error {
return nil
@ -55,11 +55,11 @@ horizontally and vertically.
The following code aligns the button widget into the top right corner as shown above:
```go
tb, err := termbox.New()
t, err := tcell.New()
if err != nil {
panic(err)
}
defer tb.Close()
defer t.Close()
b, err := button.New("hello world", func() error {
return nil

@ -40,9 +40,9 @@ The following code snippet starts Termdash with an empty container and no widget
```go
// Create the terminal.
t, err := termbox.New()
t, err := tcell.New()
if err != nil {
return fmt.Errorf("termbox.New => %v", err)
return fmt.Errorf("tcell.New => %v", err)
}
defer t.Close()
@ -81,9 +81,9 @@ The following code snippet starts Termdash with an empty container and no widget
```go
// Create the terminal.
t, err := termbox.New()
t, err := tcell.New()
if err != nil {
return fmt.Errorf("termbox.New => %v", err)
return fmt.Errorf("tcell.New => %v", err)
}
defer t.Close()