diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 3a57f24..ebdb778 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -10,15 +10,15 @@ jobs: os: [ubuntu-latest, windows-latest] steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + - name: Set up Go uses: actions/setup-go@v5 with: go-version: 1.18 id: go - - name: Check out code into the Go module directory - uses: actions/checkout@v4 - - name: Get dependencies run: go get -v -t -d ./... diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index a22fa1f..854e87d 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -7,6 +7,9 @@ jobs: runs-on: [ ubuntu-latest ] steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + - name: Set up Go uses: actions/setup-go@v5 with: @@ -16,9 +19,6 @@ jobs: - name: Go version run: go version - - name: Check out code into the Go module directory - uses: actions/checkout@v4 - - name: Get dependencies run: go get -v -t -d ./... diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index de62933..7fc66df 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -7,15 +7,15 @@ jobs: runs-on: [ windows-latest ] steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + - name: Set up Go uses: actions/setup-go@v5 with: go-version: 1.18 id: go - - name: Check out code into the Go module directory - uses: actions/checkout@v4 - - name: Get dependencies run: go get -v -t -d ./... diff --git a/README-wasm.md b/README-wasm.md index faf9685..278baca 100644 --- a/README-wasm.md +++ b/README-wasm.md @@ -20,7 +20,7 @@ In `tcell.js`, you also need to change the constant ```js const wasmFilePath = "yourfile.wasm" ``` -to the file you outputed to when building. +to the file you outputted to when building. ## Displaying your project @@ -49,7 +49,7 @@ func main() { To see the webpage with this example, you can type in `localhost:8080/tcell.html` into your browser while `server.go` is running. ### Embedding -It is recomended to use an iframe if you want to embed the app into a webpage: +It is recommended to use an iframe if you want to embed the app into a webpage: ```html ``` diff --git a/README.md b/README.md index 00b5a28..3c9d62c 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ A brief, and still somewhat rough, [tutorial](TUTORIAL.md) is available. - [godu](https://github.com/viktomas/godu) - utility to discover large files/folders - [tview](https://github.com/rivo/tview/) - rich interactive widgets - [cview](https://code.rocketnine.space/tslocum/cview) - user interface toolkit (fork of _tview_) -- [awsome gocui](https://github.com/awesome-gocui/gocui) - Go Console User Interface +- [awesome gocui](https://github.com/awesome-gocui/gocui) - Go Console User Interface - [gomandelbrot](https://github.com/rgm3/gomandelbrot) - Mandelbrot! - [WTF](https://github.com/senorprogrammer/wtf) - personal information dashboard - [browsh](https://github.com/browsh-org/browsh) - modern web browser ([video](https://www.youtube.com/watch?v=HZq86XfBoRo)) @@ -69,6 +69,7 @@ A brief, and still somewhat rough, [tutorial](TUTORIAL.md) is available. - [hero.go](https://github.com/barisbll/hero.go) - 2d monster shooter ([video](https://user-images.githubusercontent.com/40062673/277157369-240d7606-b471-4aa1-8c54-4379a513122b.mp4)) - [go-tetris](https://github.com/aaronriekenberg/go-tetris) - simple tetris game for native terminal and WASM using github actions+pages - [tiles](https://github.com/16point7/tiles) - a lightweight implementation of 2048 +- [oddshub](https://github.com/dos-2/oddshub) - A TUI designed for analyzing sports betting odds ## Pure Go Terminfo Database diff --git a/cell.go b/cell.go index 0debeee..ae3a6f2 100644 --- a/cell.go +++ b/cell.go @@ -58,7 +58,7 @@ func (cb *CellBuffer) SetContent(x int, y int, // dirty as well as the base cell, to make sure we consider // both cells as dirty together. We only need to do this // if we're changing content - if (c.width > 0) && (mainc != c.currMain || !reflect.DeepEqual(combc, c.currComb)) { + if (c.width > 0) && (mainc != c.currMain || len(combc) != len(c.currComb) || (len(combc) > 0 && !reflect.DeepEqual(combc, c.currComb))) { for i := 0; i < c.width; i++ { cb.SetDirty(x+i, y, true) } diff --git a/terminfo/base/base.go b/terminfo/base/base.go index fbecdfa..d54a381 100644 --- a/terminfo/base/base.go +++ b/terminfo/base/base.go @@ -23,7 +23,7 @@ package base import ( // The following imports just register themselves -- - // thse are the terminal types we aggregate in this package. + // these are the terminal types we aggregate in this package. _ "github.com/gdamore/tcell/v2/terminfo/a/ansi" _ "github.com/gdamore/tcell/v2/terminfo/v/vt100" _ "github.com/gdamore/tcell/v2/terminfo/v/vt102" diff --git a/terminfo/models.txt b/terminfo/models.txt index feea5e2..f54a722 100644 --- a/terminfo/models.txt +++ b/terminfo/models.txt @@ -14,7 +14,7 @@ pcansi rxvt,rxvt-256color,rxvt-88color,rxvt-unicode,rxvt-unicode-256color screen,screen-256color st,st-256color|simpleterm -tmux +tmux,tmux-256color vt52 vt100 vt102 diff --git a/terminfo/t/tmux/term.go b/terminfo/t/tmux/term.go index 6c8be35..8aa76a0 100644 --- a/terminfo/t/tmux/term.go +++ b/terminfo/t/tmux/term.go @@ -72,4 +72,71 @@ func init() { DottedUnderline: "\x1b[4:4m", DashedUnderline: "\x1b[4:5m", }) + + // tmux with 256 colors + terminfo.AddTerminfo(&terminfo.Terminfo{ + Name: "tmux-256color", + Columns: 80, + Lines: 24, + Colors: 256, + Bell: "\a", + Clear: "\x1b[H\x1b[J", + EnterCA: "\x1b[?1049h", + ExitCA: "\x1b[?1049l", + ShowCursor: "\x1b[34h\x1b[?25h", + HideCursor: "\x1b[?25l", + AttrOff: "\x1b[m\x0f", + Underline: "\x1b[4m", + Bold: "\x1b[1m", + Dim: "\x1b[2m", + Italic: "\x1b[3m", + Blink: "\x1b[5m", + Reverse: "\x1b[7m", + EnterKeypad: "\x1b[?1h\x1b=", + ExitKeypad: "\x1b[?1l\x1b>", + SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", + SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", + SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", + ResetFgBg: "\x1b[39;49m", + PadChar: "\x00", + AltChars: "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", + EnterAcs: "\x0e", + ExitAcs: "\x0f", + EnableAcs: "\x1b(B\x1b)0", + StrikeThrough: "\x1b[9m", + Mouse: "\x1b[M", + SetCursor: "\x1b[%i%p1%d;%p2%dH", + CursorBack1: "\b", + CursorUp1: "\x1bM", + KeyUp: "\x1bOA", + KeyDown: "\x1bOB", + KeyRight: "\x1bOC", + KeyLeft: "\x1bOD", + KeyInsert: "\x1b[2~", + KeyDelete: "\x1b[3~", + KeyBackspace: "\x7f", + KeyHome: "\x1b[1~", + KeyEnd: "\x1b[4~", + KeyPgUp: "\x1b[5~", + KeyPgDn: "\x1b[6~", + KeyF1: "\x1bOP", + KeyF2: "\x1bOQ", + KeyF3: "\x1bOR", + KeyF4: "\x1bOS", + KeyF5: "\x1b[15~", + KeyF6: "\x1b[17~", + KeyF7: "\x1b[18~", + KeyF8: "\x1b[19~", + KeyF9: "\x1b[20~", + KeyF10: "\x1b[21~", + KeyF11: "\x1b[23~", + KeyF12: "\x1b[24~", + KeyBacktab: "\x1b[Z", + Modifiers: 1, + AutoMargin: true, + DoubleUnderline: "\x1b[4:2m", + CurlyUnderline: "\x1b[4:3m", + DottedUnderline: "\x1b[4:4m", + DashedUnderline: "\x1b[4:5m", + }) } diff --git a/terms_dynamic.go b/terms_dynamic.go index f552b0e..9e54944 100644 --- a/terms_dynamic.go +++ b/terms_dynamic.go @@ -27,9 +27,14 @@ import ( // will be automatically included anyway. "github.com/gdamore/tcell/v2/terminfo" "github.com/gdamore/tcell/v2/terminfo/dynamic" + + "fmt" ) func loadDynamicTerminfo(term string) (*terminfo.Terminfo, error) { + if term == "" { + return nil, fmt.Errorf("%w: term not set", ErrTermNotFound) + } ti, _, e := dynamic.LoadTerminfo(term) if e != nil { return nil, e diff --git a/views/spacer.go b/views/spacer.go index 7bba7b7..e30801f 100644 --- a/views/spacer.go +++ b/views/spacer.go @@ -28,7 +28,7 @@ type Spacer struct { // Draw is called to update the displayed content. func (*Spacer) Draw() {} -// Size always returns 0, 0, since no size is ever *requird* to display nothing. +// Size always returns 0, 0, since no size is ever *required* to display nothing. func (*Spacer) Size() (int, int) { return 0, 0 } diff --git a/views/widget.go b/views/widget.go index 279e452..11a61f3 100644 --- a/views/widget.go +++ b/views/widget.go @@ -169,7 +169,7 @@ type EventWidgetResize struct { widgetEvent } -// EventWidgetMove is fired whenver a widget changes location. +// EventWidgetMove is fired whenever a widget changes location. type EventWidgetMove struct { widgetEvent }