├── vendor ├── github.com │ ├── gdamore │ │ ├── tcell │ │ │ ├── .gitignore │ │ │ ├── terminfo │ │ │ │ ├── .gitignore │ │ │ │ ├── TERMINALS.md │ │ │ │ ├── term_adm3a.go │ │ │ │ ├── term_hz1500.go │ │ │ │ ├── term_Eterm.go │ │ │ │ ├── term_vt52.go │ │ │ │ ├── models.txt │ │ │ │ ├── term_tvi921.go │ │ │ │ ├── term_xnuppc.go │ │ │ │ ├── term_tvi912.go │ │ │ │ ├── term_tvi910.go │ │ │ │ ├── term_tvi970.go │ │ │ │ ├── term_tvi925.go │ │ │ │ ├── term_pcansi.go │ │ │ │ ├── term_tvi950.go │ │ │ │ ├── term_ansi.go │ │ │ │ ├── term_bsdos_pc.go │ │ │ │ ├── term_sun.go │ │ │ │ ├── term_vt102.go │ │ │ │ ├── term_hpterm.go │ │ │ │ ├── term_vt400.go │ │ │ │ ├── term_vt100.go │ │ │ │ ├── term_sun_color.go │ │ │ │ ├── term_vt420.go │ │ │ │ ├── term_beterm.go │ │ │ │ ├── term_vt220.go │ │ │ │ ├── term_wy50.go │ │ │ │ ├── term_wy60.go │ │ │ │ ├── term_wy99_ansi.go │ │ │ │ ├── term_wy99a_ansi.go │ │ │ │ ├── term_vt320.go │ │ │ │ ├── term_cygwin.go │ │ │ │ ├── term_dtterm.go │ │ │ │ ├── term_screen.go │ │ │ │ ├── term_kterm.go │ │ │ │ ├── term_linux.go │ │ │ │ ├── term_screen_256color.go │ │ │ │ ├── term_aixterm.go │ │ │ │ ├── term_d200.go │ │ │ │ ├── term_rxvt_unicode.go │ │ │ │ ├── term_rxvt_unicode_256color.go │ │ │ │ ├── term_d210.go │ │ │ │ ├── term_aterm.go │ │ │ │ ├── term_rxvt.go │ │ │ │ ├── term_Eterm_256color.go │ │ │ │ ├── term_rxvt_256color.go │ │ │ │ ├── term_konsole.go │ │ │ │ ├── term_konsole_256color.go │ │ │ │ └── mkdatabase.sh │ │ │ ├── AUTHORS │ │ │ ├── .travis.yml │ │ │ ├── .appveyor.yml │ │ │ ├── charset_stub.go │ │ │ ├── charset_windows.go │ │ │ ├── console_stub.go │ │ │ ├── tscreen_stub.go │ │ │ ├── attr.go │ │ │ ├── tscreen_windows.go │ │ │ ├── resize.go │ │ │ ├── interrupt.go │ │ │ ├── charset_unix.go │ │ │ ├── colorfit.go │ │ │ ├── event.go │ │ │ ├── doc.go │ │ │ ├── errors.go │ │ │ ├── tscreen_bsd.go │ │ │ ├── runes.go │ │ │ ├── tscreen_linux.go │ │ │ ├── mouse.go │ │ │ └── style.go │ │ └── encoding │ │ │ ├── .travis.yml │ │ │ ├── .appveyor.yml │ │ │ ├── doc.go │ │ │ ├── latin5.go │ │ │ ├── latin1.go │ │ │ ├── ascii.go │ │ │ ├── README.md │ │ │ └── utf8.go │ ├── mattn │ │ └── go-runewidth │ │ │ ├── runewidth_js.go │ │ │ ├── .travis.yml │ │ │ ├── runewidth_windows.go │ │ │ ├── README.mkd │ │ │ ├── LICENSE │ │ │ └── runewidth_posix.go │ └── lucasb-eyer │ │ └── go-colorful │ │ ├── .travis.yml │ │ ├── .gitignore │ │ ├── happy_palettegen.go │ │ ├── warm_palettegen.go │ │ ├── hexcolor.go │ │ ├── LICENSE │ │ └── colorgens.go └── golang.org │ └── x │ └── text │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── PATENTS │ ├── LICENSE │ ├── unicode │ └── cldr │ │ ├── base.go │ │ ├── cldr.go │ │ ├── slice.go │ │ └── decode.go │ └── encoding │ └── internal │ └── identifier │ ├── identifier.go │ └── gen.go ├── _examples ├── textbox │ ├── example.png │ └── main.go ├── barchart │ ├── example.gif │ └── main.go ├── dotmatrix │ ├── example.png │ └── main.go ├── gridlayout │ ├── example.png │ └── main.go ├── border │ └── main.go ├── donut │ └── main.go └── demo │ └── main.go ├── component.go ├── cell.go ├── events.go ├── .gitignore ├── util.go ├── style.go ├── tile.go ├── Gopkg.toml ├── LICENSE ├── Gopkg.lock ├── row.go ├── column.go ├── donut.go ├── keys.go ├── textbox.go ├── border.go ├── README.md └── barchart.go /vendor/github.com/gdamore/tcell/.gitignore: -------------------------------------------------------------------------------- 1 | coverage.txt 2 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/.gitignore: -------------------------------------------------------------------------------- 1 | mkinfo 2 | -------------------------------------------------------------------------------- /_examples/textbox/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liamg/gobless/HEAD/_examples/textbox/example.png -------------------------------------------------------------------------------- /_examples/barchart/example.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liamg/gobless/HEAD/_examples/barchart/example.gif -------------------------------------------------------------------------------- /_examples/dotmatrix/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liamg/gobless/HEAD/_examples/dotmatrix/example.png -------------------------------------------------------------------------------- /_examples/gridlayout/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liamg/gobless/HEAD/_examples/gridlayout/example.png -------------------------------------------------------------------------------- /vendor/github.com/gdamore/encoding/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.3 5 | - 1.5 6 | - tip 7 | -------------------------------------------------------------------------------- /component.go: -------------------------------------------------------------------------------- 1 | package gobless 2 | 3 | type Component interface { 4 | GetTiles(gui *GUI) []Tile 5 | SetX(x int) 6 | SetY(y int) 7 | SetWidth(w int) 8 | SetHeight(h int) 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/AUTHORS: -------------------------------------------------------------------------------- 1 | Garrett D'Amore 2 | Zachary Yedidia 3 | Junegunn Choi 4 | Staysail Systems, Inc. 5 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /cell.go: -------------------------------------------------------------------------------- 1 | package gobless 2 | 3 | type Cell struct { 4 | Rune rune 5 | Style Style 6 | } 7 | 8 | func NewCell(c rune, style Style) Cell { 9 | return Cell{ 10 | Rune: c, 11 | Style: style, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /events.go: -------------------------------------------------------------------------------- 1 | package gobless 2 | 3 | type Event interface{} 4 | 5 | type KeyPressEvent struct { 6 | Key Key 7 | //Modifier Modifier // @todo 8 | } 9 | 10 | type ResizeEvent struct { 11 | Width int 12 | Height int 13 | } 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.dll 4 | *.so 5 | *.dylib 6 | 7 | # Test binary, build with `go test -c` 8 | *.test 9 | 10 | # Output of the go coverage tool, specifically when used with LiteIDE 11 | *.out 12 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/runewidth_js.go: -------------------------------------------------------------------------------- 1 | // +build js 2 | 3 | package runewidth 4 | 5 | func IsEastAsian() bool { 6 | // TODO: Implement this for the web. Detect east asian in a compatible way, and return true. 7 | return false 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - tip 4 | before_install: 5 | - go get github.com/mattn/goveralls 6 | - go get golang.org/x/tools/cmd/cover 7 | script: 8 | - $HOME/gopath/bin/goveralls -repotoken lAKAWPzcGsD3A8yBX3BGGtRUdJ6CaGERL 9 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/TERMINALS.md: -------------------------------------------------------------------------------- 1 | TERMINALS 2 | ========= 3 | 4 | The best way to populate terminals on Debian is to install ncurses, 5 | ncurses-term, screen, tmux, rxvt-unicode, and dvtm. This populates the 6 | the terminfo database so that we can have a reasonable set of starting 7 | terminals. 8 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.5.x 5 | - 1.6.x 6 | - 1.7.x 7 | - 1.8.x 8 | - master 9 | 10 | before_install: 11 | - go get -t -v ./... 12 | 13 | script: 14 | - go test -race -coverprofile=coverage.txt -covermode=atomic 15 | 16 | after_success: 17 | - bash <(curl -s https://codecov.io/bash) 18 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/.appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.0.{build} 2 | clone_folder: c:\gopath\src\github.com\gdamore\tcell 3 | environment: 4 | GOPATH: c:\gopath 5 | build_script: 6 | - go version 7 | - go env 8 | - SET PATH=%LOCALAPPDATA%\atom\bin;%GOPATH%\bin;%PATH% 9 | - go get -t ./... 10 | - go build 11 | - go install ./... 12 | test_script: 13 | - go test ./... 14 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/encoding/.appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.0.{build} 2 | clone_folder: c:\gopath\src\github.com\gdamore\encoding 3 | environment: 4 | GOPATH: c:\gopath 5 | build_script: 6 | - go version 7 | - go env 8 | - SET PATH=%LOCALAPPDATA%\atom\bin;%GOPATH%\bin;%PATH% 9 | - go get -t ./... 10 | - go build 11 | - go install ./... 12 | test_script: 13 | - go test ./... 14 | -------------------------------------------------------------------------------- /vendor/github.com/lucasb-eyer/go-colorful/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | install: 3 | - go get golang.org/x/tools/cmd/cover 4 | - go get gopkg.in/DATA-DOG/go-sqlmock.v1 5 | - go get github.com/mattn/goveralls 6 | script: 7 | - go test -v -covermode=count -coverprofile=coverage.out 8 | - if [[ "$TRAVIS_PULL_REQUEST" = "false" ]]; then $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN; fi 9 | -------------------------------------------------------------------------------- /vendor/github.com/lucasb-eyer/go-colorful/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Vim swap files 11 | .*.sw? 12 | 13 | # Architecture specific extensions/prefixes 14 | *.[568vq] 15 | [568vq].out 16 | 17 | *.cgo1.go 18 | *.cgo2.c 19 | _cgo_defun.c 20 | _cgo_gotypes.go 21 | _cgo_export.* 22 | 23 | _testmain.go 24 | 25 | *.exe 26 | 27 | # Code coverage stuff 28 | coverage.out 29 | -------------------------------------------------------------------------------- /util.go: -------------------------------------------------------------------------------- 1 | package gobless 2 | 3 | import "fmt" 4 | 5 | func shortenInt(number int) string { 6 | 7 | switch true { 8 | case number > 1000000000000: 9 | return fmt.Sprintf("%.1fT", float64(number)/1000000000000.0) 10 | case number > 1000000000: 11 | return fmt.Sprintf("%.1fG", float64(number)/1000000000.0) 12 | case number > 1000000: 13 | return fmt.Sprintf("%.1fM", float64(number)/1000000.0) 14 | case number > 1000: 15 | return fmt.Sprintf("%.1fK", float64(number)/1000.0) 16 | } 17 | 18 | return fmt.Sprintf("%d", number) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/border/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/liamg/gobless" 5 | ) 6 | 7 | func main() { 8 | 9 | gui := gobless.NewGUI() 10 | if err := gui.Init(); err != nil { 11 | panic(err) 12 | } 13 | defer gui.Close() 14 | 15 | border := gobless.NewBorder() 16 | border.SetWidth(8) 17 | border.SetHeight(4) 18 | border.SetX(15) 19 | border.SetY(5) 20 | 21 | gui.Render(border) 22 | 23 | gui.HandleKeyPress(gobless.KeyCtrlQ, func(event gobless.KeyPressEvent) { 24 | gui.Close() 25 | }) 26 | 27 | gui.Loop() 28 | 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_adm3a.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // lsi adm3a 7 | AddTerminfo(&Terminfo{ 8 | Name: "adm3a", 9 | Columns: 80, 10 | Lines: 24, 11 | Bell: "\a", 12 | Clear: "\x0032$<1/>", 13 | PadChar: "\x00", 14 | SetCursor: "\x1b=%p1%' '%+%c%p2%' '%+%c", 15 | CursorBack1: "\b", 16 | CursorUp1: "\v", 17 | KeyUp: "\v", 18 | KeyDown: "\n", 19 | KeyRight: "\f", 20 | KeyLeft: "\b", 21 | }) 22 | } 23 | -------------------------------------------------------------------------------- /_examples/donut/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/liamg/gobless" 4 | 5 | func main() { 6 | gui := gobless.NewGUI() 7 | if err := gui.Init(); err != nil { 8 | panic(err) 9 | } 10 | defer gui.Close() 11 | 12 | donut := gobless.NewDonut() 13 | donut.SetY(4) 14 | donut.SetX(1) 15 | donut.SetWidth(18) 16 | donut.SetHeight(18) 17 | 18 | donut.SetLabel("EVIL") 19 | donut.SetPercent(80) 20 | 21 | gui.Render(donut) 22 | 23 | gui.HandleKeyPress(gobless.KeyCtrlQ, func(event gobless.KeyPressEvent) { 24 | gui.Close() 25 | }) 26 | 27 | gui.Loop() 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/runewidth_windows.go: -------------------------------------------------------------------------------- 1 | package runewidth 2 | 3 | import ( 4 | "syscall" 5 | ) 6 | 7 | var ( 8 | kernel32 = syscall.NewLazyDLL("kernel32") 9 | procGetConsoleOutputCP = kernel32.NewProc("GetConsoleOutputCP") 10 | ) 11 | 12 | // IsEastAsian return true if the current locale is CJK 13 | func IsEastAsian() bool { 14 | r1, _, _ := procGetConsoleOutputCP.Call() 15 | if r1 == 0 { 16 | return false 17 | } 18 | 19 | switch int(r1) { 20 | case 932, 51932, 936, 949, 950: 21 | return true 22 | } 23 | 24 | return false 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_hz1500.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // hazeltine 1500 7 | AddTerminfo(&Terminfo{ 8 | Name: "hz1500", 9 | Columns: 80, 10 | Lines: 24, 11 | Bell: "\a", 12 | Clear: "~\x1c", 13 | PadChar: "\x00", 14 | SetCursor: "~\x0021%p2%p2%?%{30}%>%t%' '%+%;%'`'%+%c%p1%'`'%+%c", 15 | CursorBack1: "\b", 16 | CursorUp1: "~\f", 17 | KeyUp: "~\f", 18 | KeyDown: "\n", 19 | KeyRight: "\x10", 20 | KeyLeft: "\b", 21 | KeyHome: "~\x12", 22 | }) 23 | } 24 | -------------------------------------------------------------------------------- /style.go: -------------------------------------------------------------------------------- 1 | package gobless 2 | 3 | import "github.com/gdamore/tcell" 4 | 5 | type Style struct { 6 | ForegroundColor Color 7 | BackgroundColor Color 8 | } 9 | 10 | var DefaultStyle = Style{ 11 | ForegroundColor: ColorWhite, 12 | BackgroundColor: ColorBlack, 13 | } 14 | 15 | func NewStyle(backgroundColor Color, foregroundColor Color) Style { 16 | return Style{ 17 | BackgroundColor: backgroundColor, 18 | ForegroundColor: foregroundColor, 19 | } 20 | } 21 | 22 | func (style *Style) toTCell() tcell.Style { 23 | return tcell.StyleDefault.Foreground(style.ForegroundColor.toTCell()).Background(style.BackgroundColor.toTCell()) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_Eterm.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // gnu emacs term.el terminal emulation 7 | AddTerminfo(&Terminfo{ 8 | Name: "eterm", 9 | Columns: 80, 10 | Lines: 24, 11 | Bell: "\a", 12 | Clear: "\x1b[H\x1b[J", 13 | EnterCA: "\x1b7\x1b[?47h", 14 | ExitCA: "\x1b[2J\x1b[?47l\x1b8", 15 | AttrOff: "\x1b[m", 16 | Underline: "\x1b[4m", 17 | Bold: "\x1b[1m", 18 | Reverse: "\x1b[7m", 19 | PadChar: "\x00", 20 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 21 | CursorBack1: "\b", 22 | CursorUp1: "\x1b[A", 23 | }) 24 | } 25 | -------------------------------------------------------------------------------- /tile.go: -------------------------------------------------------------------------------- 1 | package gobless 2 | 3 | import "image" 4 | 5 | type Tile struct { 6 | Rectangle image.Rectangle 7 | Cells map[image.Point]Cell 8 | } 9 | 10 | func NewTile(x1 int, y1 int, x2 int, y2 int) Tile { 11 | return Tile{ 12 | Rectangle: image.Rect(x1, y1, x2, y2), 13 | Cells: map[image.Point]Cell{}, 14 | } 15 | } 16 | 17 | func (tile *Tile) SetCell(point image.Point, cell Cell) { 18 | tile.Cells[point] = cell 19 | } 20 | 21 | func (tile *Tile) SetCells(rectangle image.Rectangle, cell Cell) { 22 | for x := rectangle.Min.X; x <= rectangle.Max.X; x++ { 23 | for y := rectangle.Min.Y; y <= rectangle.Max.Y; y++ { 24 | tile.SetCell(image.Point{X: x, Y: y}, cell) 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_vt52.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // dec vt52 7 | AddTerminfo(&Terminfo{ 8 | Name: "vt52", 9 | Columns: 80, 10 | Lines: 24, 11 | Bell: "\a", 12 | Clear: "\x1bH\x1bJ", 13 | PadChar: "\x00", 14 | AltChars: ".kffgghhompoqqss", 15 | EnterAcs: "\x1bF", 16 | ExitAcs: "\x1bG", 17 | SetCursor: "\x1bY%p1%' '%+%c%p2%' '%+%c", 18 | CursorBack1: "\x1bD", 19 | CursorUp1: "\x1bA", 20 | KeyUp: "\x1bA", 21 | KeyDown: "\x1bB", 22 | KeyRight: "\x1bC", 23 | KeyLeft: "\x1bD", 24 | KeyBackspace: "\b", 25 | }) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/charset_stub.go: -------------------------------------------------------------------------------- 1 | // +build plan9 nacl 2 | 3 | // Copyright 2015 The TCell Authors 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use file except in compliance with the License. 7 | // You may obtain a copy of the license at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | package tcell 18 | 19 | func getCharset() string { 20 | return "" 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/charset_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | // Copyright 2015 The TCell Authors 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use file except in compliance with the License. 7 | // You may obtain a copy of the license at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | package tcell 18 | 19 | func getCharset() string { 20 | return "UTF-16" 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/encoding/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Garrett D'Amore 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use file except in compliance with the License. 5 | // You may obtain a copy of the license at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package encoding provides a few of the encoding structures that are 16 | // missing from the Go x/text/encoding tree. 17 | package encoding 18 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/models.txt: -------------------------------------------------------------------------------- 1 | adm3a 2 | aixterm 3 | ansi 4 | aterm 5 | beterm 6 | bsdos-pc 7 | cygwin 8 | d200 9 | d210 10 | dtterm 11 | Eterm 12 | Eterm-256color 13 | eterm 14 | gnome 15 | gnome-256color 16 | hpterm 17 | hz1500 18 | konsole 19 | konsole-256color 20 | kterm 21 | linux 22 | pcansi 23 | rxvt 24 | rxvt-256color 25 | rxvt-unicode 26 | rxvt-unicode-256color 27 | screen 28 | screen-256color 29 | st 30 | st-256color 31 | st-truecolor 32 | st-meta 33 | st-meta-256color 34 | st-meta-truecolor 35 | sun 36 | sun-color 37 | tvi910 38 | tvi912 39 | tvi921 40 | tvi925 41 | tvi950 42 | tvi970 43 | vt52 44 | vt100 45 | vt102 46 | vt220 47 | vt320 48 | vt400 49 | vt420 50 | wy50 51 | wy60 52 | wy99-ansi 53 | wy99a-ansi 54 | xfce 55 | xnuppc 56 | xterm 57 | xterm 58 | xterm-256color 59 | xterm-truecolor 60 | -------------------------------------------------------------------------------- /Gopkg.toml: -------------------------------------------------------------------------------- 1 | # Gopkg.toml example 2 | # 3 | # Refer to https://golang.github.io/dep/docs/Gopkg.toml.html 4 | # for detailed Gopkg.toml documentation. 5 | # 6 | # required = ["github.com/user/thing/cmd/thing"] 7 | # ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] 8 | # 9 | # [[constraint]] 10 | # name = "github.com/user/project" 11 | # version = "1.0.0" 12 | # 13 | # [[constraint]] 14 | # name = "github.com/user/project2" 15 | # branch = "dev" 16 | # source = "github.com/myfork/project2" 17 | # 18 | # [[override]] 19 | # name = "github.com/x/y" 20 | # version = "2.4.0" 21 | # 22 | # [prune] 23 | # non-go = false 24 | # go-tests = true 25 | # unused-packages = true 26 | 27 | 28 | [[constraint]] 29 | name = "github.com/gdamore/tcell" 30 | version = "1.0.0" 31 | 32 | [prune] 33 | go-tests = true 34 | unused-packages = true 35 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_tvi921.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // televideo model 921 with sysline same as page & real vi function 7 | AddTerminfo(&Terminfo{ 8 | Name: "tvi921", 9 | Columns: 80, 10 | Lines: 24, 11 | Clear: "\x1a", 12 | ShowCursor: "\x1b.3", 13 | AttrOff: "\x1bG0", 14 | Underline: "\x1bG8", 15 | Reverse: "\x1bG4", 16 | PadChar: "\x00", 17 | EnterAcs: "\x1b$", 18 | ExitAcs: "\x1b%%", 19 | SetCursor: "\x1b=%p1%' '%+%c%p2%' '%+%c$<3/>", 20 | CursorBack1: "\b", 21 | CursorUp1: "\v", 22 | KeyUp: "\v", 23 | KeyDown: "\x16", 24 | KeyRight: "\f", 25 | KeyLeft: "\b", 26 | KeyInsert: "\x1bQ", 27 | KeyDelete: "\x1bW", 28 | KeyBackspace: "\b", 29 | KeyClear: "\x1a", 30 | }) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/README.mkd: -------------------------------------------------------------------------------- 1 | go-runewidth 2 | ============ 3 | 4 | [![Build Status](https://travis-ci.org/mattn/go-runewidth.png?branch=master)](https://travis-ci.org/mattn/go-runewidth) 5 | [![Coverage Status](https://coveralls.io/repos/mattn/go-runewidth/badge.png?branch=HEAD)](https://coveralls.io/r/mattn/go-runewidth?branch=HEAD) 6 | [![GoDoc](https://godoc.org/github.com/mattn/go-runewidth?status.svg)](http://godoc.org/github.com/mattn/go-runewidth) 7 | [![Go Report Card](https://goreportcard.com/badge/github.com/mattn/go-runewidth)](https://goreportcard.com/report/github.com/mattn/go-runewidth) 8 | 9 | Provides functions to get fixed width of the character or string. 10 | 11 | Usage 12 | ----- 13 | 14 | ```go 15 | runewidth.StringWidth("つのだ☆HIRO") == 12 16 | ``` 17 | 18 | 19 | Author 20 | ------ 21 | 22 | Yasuhiro Matsumoto 23 | 24 | License 25 | ------- 26 | 27 | under the MIT License: http://mattn.mit-license.org/2013 28 | -------------------------------------------------------------------------------- /vendor/github.com/lucasb-eyer/go-colorful/happy_palettegen.go: -------------------------------------------------------------------------------- 1 | package colorful 2 | 3 | import ( 4 | "math/rand" 5 | ) 6 | 7 | // Uses the HSV color space to generate colors with similar S,V but distributed 8 | // evenly along their Hue. This is fast but not always pretty. 9 | // If you've got time to spare, use Lab (the non-fast below). 10 | func FastHappyPalette(colorsCount int) (colors []Color) { 11 | colors = make([]Color, colorsCount) 12 | 13 | for i := 0 ; i < colorsCount ; i++ { 14 | colors[i] = Hsv(float64(i)*(360.0/float64(colorsCount)), 0.8 + rand.Float64()*0.2, 0.65 + rand.Float64()*0.2) 15 | } 16 | return 17 | } 18 | 19 | func HappyPalette(colorsCount int) ([]Color, error) { 20 | pimpy := func(l, a, b float64) bool { 21 | _, c, _ := LabToHcl(l, a, b) 22 | return 0.3 <= c && 0.4 <= l && l <= 0.8 23 | } 24 | return SoftPaletteEx(colorsCount, SoftPaletteSettings{pimpy, 50, true}) 25 | } 26 | 27 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_xnuppc.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // Darwin PowerPC Console (color) 7 | AddTerminfo(&Terminfo{ 8 | Name: "xnuppc", 9 | Aliases: []string{"darwin"}, 10 | Colors: 8, 11 | Clear: "\x1b[H\x1b[J", 12 | AttrOff: "\x1b[m\x0017", 13 | Underline: "\x1b[4m", 14 | Bold: "\x1b[1m", 15 | Reverse: "\x1b[7m", 16 | EnterKeypad: "\x1b[?1h\x1b=", 17 | ExitKeypad: "\x1b[?1l\x1b>", 18 | SetFg: "\x1b[3%p1%dm", 19 | SetBg: "\x1b[4%p1%dm", 20 | SetFgBg: "\x1b[3%p1%d;4%p2%dm", 21 | PadChar: "\x00", 22 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 23 | CursorBack1: "\x1b[D", 24 | CursorUp1: "\x1b[A", 25 | KeyUp: "\x1bOA", 26 | KeyDown: "\x1bOB", 27 | KeyRight: "\x1bOC", 28 | KeyLeft: "\x1bOD", 29 | KeyBackspace: "177", 30 | }) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/console_stub.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | // Copyright 2015 The TCell Authors 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use file except in compliance with the License. 7 | // You may obtain a copy of the license at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | package tcell 18 | 19 | // NewConsoleScreen returns a console based screen. This platform 20 | // doesn't have support for any, so it returns nil and a suitable error. 21 | func NewConsoleScreen() (Screen, error) { 22 | return nil, ErrNoScreen 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/lucasb-eyer/go-colorful/warm_palettegen.go: -------------------------------------------------------------------------------- 1 | package colorful 2 | 3 | import ( 4 | "math/rand" 5 | ) 6 | 7 | // Uses the HSV color space to generate colors with similar S,V but distributed 8 | // evenly along their Hue. This is fast but not always pretty. 9 | // If you've got time to spare, use Lab (the non-fast below). 10 | func FastWarmPalette(colorsCount int) (colors []Color) { 11 | colors = make([]Color, colorsCount) 12 | 13 | for i := 0 ; i < colorsCount ; i++ { 14 | colors[i] = Hsv(float64(i)*(360.0/float64(colorsCount)), 0.55 + rand.Float64()*0.2, 0.35 + rand.Float64()*0.2) 15 | } 16 | return 17 | } 18 | 19 | func WarmPalette(colorsCount int) ([]Color, error) { 20 | warmy := func(l, a, b float64) bool { 21 | _, c, _ := LabToHcl(l, a, b) 22 | return 0.1 <= c && c <= 0.4 && 0.2 <= l && l <= 0.5 23 | } 24 | return SoftPaletteEx(colorsCount, SoftPaletteSettings{warmy, 50, true}) 25 | } 26 | 27 | -------------------------------------------------------------------------------- /vendor/github.com/lucasb-eyer/go-colorful/hexcolor.go: -------------------------------------------------------------------------------- 1 | package colorful 2 | 3 | import ( 4 | "database/sql/driver" 5 | "fmt" 6 | "reflect" 7 | ) 8 | 9 | // A HexColor is a Color stored as a hex string "#rrggbb". It implements the 10 | // database/sql.Scanner and database/sql/driver.Value interfaces. 11 | type HexColor Color 12 | 13 | type errUnsupportedType struct { 14 | got interface{} 15 | want reflect.Type 16 | } 17 | 18 | func (hc *HexColor) Scan(value interface{}) error { 19 | s, ok := value.(string) 20 | if !ok { 21 | return errUnsupportedType{got: reflect.TypeOf(value), want: reflect.TypeOf("")} 22 | } 23 | c, err := Hex(s) 24 | if err != nil { 25 | return err 26 | } 27 | *hc = HexColor(c) 28 | return nil 29 | } 30 | 31 | func (hc *HexColor) Value() (driver.Value, error) { 32 | return Color(*hc).Hex(), nil 33 | } 34 | 35 | func (e errUnsupportedType) Error() string { 36 | return fmt.Sprintf("unsupported type: got %v, want a %s", e.got, e.want) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_tvi912.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // old televideo 912/914/920 7 | AddTerminfo(&Terminfo{ 8 | Name: "tvi912", 9 | Aliases: []string{"tvi914", "tvi920"}, 10 | Columns: 80, 11 | Lines: 24, 12 | Bell: "\a", 13 | Clear: "\x1a", 14 | Underline: "\x1bl", 15 | PadChar: "\x00", 16 | SetCursor: "\x1b=%p1%' '%+%c%p2%' '%+%c", 17 | CursorBack1: "\b", 18 | CursorUp1: "\v", 19 | KeyUp: "\v", 20 | KeyDown: "\n", 21 | KeyRight: "\f", 22 | KeyLeft: "\b", 23 | KeyBackspace: "\b", 24 | KeyHome: "\x1e", 25 | KeyF1: "\x01@\r", 26 | KeyF2: "\x01A\r", 27 | KeyF3: "\x01B\r", 28 | KeyF4: "\x01C\r", 29 | KeyF5: "\x01D\r", 30 | KeyF6: "\x01E\r", 31 | KeyF7: "\x01F\r", 32 | KeyF8: "\x01G\r", 33 | KeyF9: "\x01H\r", 34 | }) 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_tvi910.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // televideo model 910 7 | AddTerminfo(&Terminfo{ 8 | Name: "tvi910", 9 | Columns: 80, 10 | Lines: 24, 11 | Bell: "\a", 12 | Clear: "\x1a", 13 | AttrOff: "\x1bG0", 14 | Underline: "\x1bG8", 15 | Reverse: "\x1bG4", 16 | PadChar: "\x00", 17 | SetCursor: "\x1b=%p1%' '%+%c%p2%' '%+%c", 18 | CursorBack1: "\b", 19 | CursorUp1: "\v", 20 | KeyUp: "\v", 21 | KeyDown: "\n", 22 | KeyRight: "\f", 23 | KeyLeft: "\b", 24 | KeyBackspace: "\b", 25 | KeyHome: "\x1e", 26 | KeyF1: "\x01@\r", 27 | KeyF2: "\x01A\r", 28 | KeyF3: "\x01B\r", 29 | KeyF4: "\x01C\r", 30 | KeyF5: "\x01D\r", 31 | KeyF6: "\x01E\r", 32 | KeyF7: "\x01F\r", 33 | KeyF8: "\x01G\r", 34 | KeyF9: "\x01H\r", 35 | }) 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/tscreen_stub.go: -------------------------------------------------------------------------------- 1 | // +build nacl plan9 2 | 3 | // Copyright 2015 The TCell Authors 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use file except in compliance with the License. 7 | // You may obtain a copy of the license at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | package tcell 18 | 19 | // This stub file is for systems that have no termios. 20 | 21 | type termiosPrivate struct{} 22 | 23 | func (t *tScreen) termioInit() error { 24 | return ErrNoScreen 25 | } 26 | 27 | func (t *tScreen) termioFini() { 28 | } 29 | 30 | func (t *tScreen) getWinSize() (int, int, error) { 31 | return 0, 0, ErrNoScreen 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/encoding/latin5.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Garrett D'Amore 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use file except in compliance with the License. 5 | // You may obtain a copy of the license at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package encoding 16 | 17 | import ( 18 | "golang.org/x/text/encoding" 19 | ) 20 | 21 | // ISO8859_9 represents the 8-bit ISO8859-9 scheme. 22 | var ISO8859_9 encoding.Encoding 23 | 24 | func init() { 25 | cm := &Charmap{Map: map[byte]rune{ 26 | 0xD0: 'Ğ', 27 | 0xDD: 'İ', 28 | 0xDE: 'Ş', 29 | 0xF0: 'ğ', 30 | 0xFD: 'ı', 31 | 0xFE: 'ş', 32 | }} 33 | cm.Init() 34 | ISO8859_9 = cm 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_tvi970.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // televideo 970 7 | AddTerminfo(&Terminfo{ 8 | Name: "tvi970", 9 | Columns: 80, 10 | Lines: 24, 11 | Clear: "\x1b[H\x1b[2J", 12 | EnterCA: "\x1b[?20l\x1b[?7h\x1b[1Q", 13 | AttrOff: "\x1b[m", 14 | Underline: "\x1b[4m", 15 | PadChar: "\x00", 16 | EnterAcs: "\x1b(B", 17 | ExitAcs: "\x1b(B", 18 | SetCursor: "\x1b[%i%p1%d;%p2%df", 19 | CursorBack1: "\b", 20 | CursorUp1: "\x1bM", 21 | KeyUp: "\x1b[A", 22 | KeyDown: "\x1b[B", 23 | KeyRight: "\x1b[C", 24 | KeyLeft: "\x1b[D", 25 | KeyBackspace: "\b", 26 | KeyHome: "\x1b[H", 27 | KeyF1: "\x1b?a", 28 | KeyF2: "\x1b?b", 29 | KeyF3: "\x1b?c", 30 | KeyF4: "\x1b?d", 31 | KeyF5: "\x1b?e", 32 | KeyF6: "\x1b?f", 33 | KeyF7: "\x1b?g", 34 | KeyF8: "\x1b?h", 35 | KeyF9: "\x1b?i", 36 | }) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/lucasb-eyer/go-colorful/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Lucas Beyer 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /_examples/dotmatrix/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/liamg/gobless" 4 | 5 | func main() { 6 | gui := gobless.NewGUI() 7 | if err := gui.Init(); err != nil { 8 | panic(err) 9 | } 10 | defer gui.Close() 11 | 12 | dotMatrix := gobless.NewDotMatrix() 13 | dotMatrix.SetY(4) 14 | dotMatrix.SetX(1) 15 | dotMatrix.SetWidth(22) 16 | dotMatrix.SetHeight(22) 17 | 18 | dotMatrix.Line(0, 0, 0, 10, gobless.ColorRed) 19 | 20 | quitTextbox := gobless.NewTextBox() 21 | quitTextbox.SetWidth(24) 22 | quitTextbox.SetHeight(3) 23 | quitTextbox.SetText(`Press Ctrl-q to exit.`) 24 | 25 | dotMatrix2 := gobless.NewDotMatrix() 26 | dotMatrix2.SetY(4) 27 | dotMatrix2.SetX(24) 28 | dotMatrix2.SetWidth(22) 29 | dotMatrix2.SetHeight(22) 30 | 31 | dotMatrix2.Circle(20, 20, 10, gobless.ColorRebeccaPurple) 32 | dotMatrix2.Circle(20, 20, 15, gobless.ColorLimeGreen) 33 | dotMatrix2.Circle(20, 20, 20, gobless.ColorMaroon) 34 | 35 | gui.Render(dotMatrix, quitTextbox, dotMatrix2) 36 | 37 | gui.HandleKeyPress(gobless.KeyCtrlQ, func(event gobless.KeyPressEvent) { 38 | gui.Close() 39 | }) 40 | 41 | gui.Loop() 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_tvi925.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // televideo 925 7 | AddTerminfo(&Terminfo{ 8 | Name: "tvi925", 9 | Columns: 80, 10 | Lines: 24, 11 | Bell: "\a", 12 | Clear: "\x1a", 13 | ShowCursor: "\x1b.4", 14 | AttrOff: "\x1bG0", 15 | Underline: "\x1bG8", 16 | Reverse: "\x1bG4", 17 | PadChar: "\x00", 18 | SetCursor: "\x1b=%p1%' '%+%c%p2%' '%+%c", 19 | CursorBack1: "\b", 20 | CursorUp1: "\v", 21 | KeyUp: "\v", 22 | KeyDown: "\x16", 23 | KeyRight: "\f", 24 | KeyLeft: "\b", 25 | KeyInsert: "\x1bQ", 26 | KeyDelete: "\x1bW", 27 | KeyBackspace: "\b", 28 | KeyHome: "\x1e", 29 | KeyF1: "\x01@\r", 30 | KeyF2: "\x01A\r", 31 | KeyF3: "\x01B\r", 32 | KeyF4: "\x01C\r", 33 | KeyF5: "\x01D\r", 34 | KeyF6: "\x01E\r", 35 | KeyF7: "\x01F\r", 36 | KeyF8: "\x01G\r", 37 | KeyF9: "\x01H\r", 38 | KeyClear: "\x1a", 39 | }) 40 | } 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Liam Galvin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Yasuhiro Matsumoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_pcansi.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // ibm-pc terminal programs claiming to be ansi 7 | AddTerminfo(&Terminfo{ 8 | Name: "pcansi", 9 | Columns: 80, 10 | Lines: 24, 11 | Colors: 8, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[J", 14 | AttrOff: "\x1b[0;10m", 15 | Underline: "\x1b[4m", 16 | Bold: "\x1b[1m", 17 | Blink: "\x1b[5m", 18 | Reverse: "\x1b[7m", 19 | SetFg: "\x1b[3%p1%dm", 20 | SetBg: "\x1b[4%p1%dm", 21 | SetFgBg: "\x1b[3%p1%d;4%p2%dm", 22 | PadChar: "\x00", 23 | AltChars: "+\x0020,\x0021-\x0030.\x190333`\x0004a261f370g361h260j331k277l332m300n305o~p304q304r304s_t303u264v301w302x263y363z362{343|330}234~376", 24 | EnterAcs: "\x1b[12m", 25 | ExitAcs: "\x1b[10m", 26 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 27 | CursorBack1: "\x1b[D", 28 | CursorUp1: "\x1b[A", 29 | KeyUp: "\x1b[A", 30 | KeyDown: "\x1b[B", 31 | KeyRight: "\x1b[C", 32 | KeyLeft: "\x1b[D", 33 | KeyBackspace: "\b", 34 | KeyHome: "\x1b[H", 35 | }) 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/attr.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The TCell Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use file except in compliance with the License. 5 | // You may obtain a copy of the license at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package tcell 16 | 17 | // AttrMask represents a mask of text attributes, apart from color. 18 | // Note that support for attributes may vary widely across terminals. 19 | type AttrMask int 20 | 21 | // Attributes are not colors, but affect the display of text. They can 22 | // be combined. 23 | const ( 24 | AttrBold AttrMask = 1 << (25 + iota) 25 | AttrBlink 26 | AttrReverse 27 | AttrUnderline 28 | AttrDim 29 | AttrNone AttrMask = 0 // Just normal text. 30 | ) 31 | 32 | const attrAll = AttrBold | AttrBlink | AttrReverse | AttrUnderline | AttrDim 33 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_tvi950.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // televideo 950 7 | AddTerminfo(&Terminfo{ 8 | Name: "tvi950", 9 | Columns: 80, 10 | Lines: 24, 11 | Bell: "\a", 12 | Clear: "\x1b*", 13 | AttrOff: "\x1bG0", 14 | Underline: "\x1bG8", 15 | Reverse: "\x1bG4", 16 | PadChar: "\x00", 17 | AltChars: "b\x0011c\x0014d\re\ni\x0013", 18 | EnterAcs: "\x15", 19 | ExitAcs: "\x18", 20 | SetCursor: "\x1b=%p1%' '%+%c%p2%' '%+%c", 21 | CursorBack1: "\b", 22 | CursorUp1: "\v", 23 | KeyUp: "\v", 24 | KeyDown: "\x16", 25 | KeyRight: "\f", 26 | KeyLeft: "\b", 27 | KeyInsert: "\x1bQ", 28 | KeyDelete: "\x1bW", 29 | KeyBackspace: "\b", 30 | KeyHome: "\x1e", 31 | KeyF1: "\x01@\r", 32 | KeyF2: "\x01A\r", 33 | KeyF3: "\x01B\r", 34 | KeyF4: "\x01C\r", 35 | KeyF5: "\x01D\r", 36 | KeyF6: "\x01E\r", 37 | KeyF7: "\x01F\r", 38 | KeyF8: "\x01G\r", 39 | KeyF9: "\x01H\r", 40 | KeyClear: "\x1b*", 41 | KeyBacktab: "\x1bI", 42 | }) 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/encoding/latin1.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Garrett D'Amore 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use file except in compliance with the License. 5 | // You may obtain a copy of the license at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package encoding 16 | 17 | import ( 18 | "golang.org/x/text/encoding" 19 | ) 20 | 21 | // ISO8859_1 represents the 8-bit ISO8859-1 scheme. It decodes directly to 22 | // UTF-8 without change, as all ISO8859-1 values are legal UTF-8. 23 | // Unicode values less than 256 (i.e. 8 bits) map 1:1 with 8859-1. 24 | // It encodes runes outside of that to 0x1A, the ASCII substitution character. 25 | var ISO8859_1 encoding.Encoding 26 | 27 | func init() { 28 | cm := &Charmap{} 29 | cm.Init() 30 | 31 | // 8859-1 is the 8-bit identity map for Unicode. 32 | ISO8859_1 = cm 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_ansi.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // ansi/pc-term compatible with color 7 | AddTerminfo(&Terminfo{ 8 | Name: "ansi", 9 | Columns: 80, 10 | Lines: 24, 11 | Colors: 8, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[J", 14 | AttrOff: "\x1b[0;10m", 15 | Underline: "\x1b[4m", 16 | Bold: "\x1b[1m", 17 | Blink: "\x1b[5m", 18 | Reverse: "\x1b[7m", 19 | SetFg: "\x1b[3%p1%dm", 20 | SetBg: "\x1b[4%p1%dm", 21 | SetFgBg: "\x1b[3%p1%d;4%p2%dm", 22 | PadChar: "\x00", 23 | AltChars: "+\x0020,\x0021-\x0030.\x190333`\x0004a261f370g361h260j331k277l332m300n305o~p304q304r304s_t303u264v301w302x263y363z362{343|330}234~376", 24 | EnterAcs: "\x1b[11m", 25 | ExitAcs: "\x1b[10m", 26 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 27 | CursorBack1: "\x1b[D", 28 | CursorUp1: "\x1b[A", 29 | KeyUp: "\x1b[A", 30 | KeyDown: "\x1b[B", 31 | KeyRight: "\x1b[C", 32 | KeyLeft: "\x1b[D", 33 | KeyInsert: "\x1b[L", 34 | KeyBackspace: "\b", 35 | KeyHome: "\x1b[H", 36 | KeyBacktab: "\x1b[Z", 37 | }) 38 | } 39 | -------------------------------------------------------------------------------- /_examples/barchart/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "math/rand" 5 | "time" 6 | 7 | "github.com/liamg/gobless" 8 | ) 9 | 10 | func main() { 11 | gui := gobless.NewGUI() 12 | if err := gui.Init(); err != nil { 13 | panic(err) 14 | } 15 | defer gui.Close() 16 | 17 | chart := gobless.NewBarChart() 18 | chart.SetTitle("Traffic") 19 | chart.SetX(2) 20 | chart.SetY(1) 21 | chart.SetWidth(40) 22 | chart.SetHeight(15) 23 | chart.SetYScale(100) 24 | chart.SetBar("Europe", 60) 25 | chart.SetBar("US", 72) 26 | chart.SetBar("Asia", 37) 27 | 28 | quitChan := make(chan bool) 29 | 30 | rand.Seed(time.Now().UnixNano()) 31 | 32 | go func() { 33 | 34 | for { 35 | 36 | select { 37 | case <-time.After(time.Second): 38 | chart.SetBar("Europe", rand.Intn(30)+70) 39 | chart.SetBar("US", rand.Intn(20)+50) 40 | chart.SetBar("Asia", rand.Intn(10)+5) 41 | gui.Render(chart) 42 | case <-quitChan: 43 | break 44 | } 45 | } 46 | 47 | }() 48 | 49 | gui.Render(chart) 50 | 51 | gui.HandleKeyPress(gobless.KeyCtrlQ, func(event gobless.KeyPressEvent) { 52 | quitChan <- true 53 | gui.Close() 54 | }) 55 | 56 | gui.HandleResize(func(event gobless.ResizeEvent) { 57 | gui.Render(chart) 58 | }) 59 | 60 | gui.Loop() 61 | } 62 | -------------------------------------------------------------------------------- /_examples/textbox/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/liamg/gobless" 4 | 5 | func main() { 6 | gui := gobless.NewGUI() 7 | if err := gui.Init(); err != nil { 8 | panic(err) 9 | } 10 | defer gui.Close() 11 | 12 | helloTextbox := gobless.NewTextBox() 13 | helloTextbox.SetX(10) 14 | helloTextbox.SetY(3) 15 | helloTextbox.SetWidth(64) 16 | helloTextbox.SetHeight(10) 17 | helloTextbox.SetTextWrap(true) 18 | helloTextbox.SetText(`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc gravida vulputate augue, ut lobortis neque semper at. In hac habitasse platea dictumst. In tincidunt diam vitae bibendum posuere. Maecenas imperdiet nunc non ex dignissim rhoncus. Integer consectetur turpis sit amet fermentum eleifend. Fusce placerat urna in purus efficitur dictum ut at nibh. Cras bibendum arcu eget ligula posuere, a tristique dolor mattis. Vivamus quis lectus cursus, eleifend leo sit amet, pellentesque dolor.`) 19 | 20 | quitTextbox := gobless.NewTextBox() 21 | quitTextbox.SetWidth(22) 22 | quitTextbox.SetHeight(3) 23 | quitTextbox.SetText(`Press Ctrl-q to exit.`) 24 | 25 | gui.Render(helloTextbox, quitTextbox) 26 | 27 | gui.HandleKeyPress(gobless.KeyCtrlQ, func(event gobless.KeyPressEvent) { 28 | gui.Close() 29 | }) 30 | 31 | gui.Loop() 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_bsdos_pc.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // IBM PC BSD/OS Console 7 | AddTerminfo(&Terminfo{ 8 | Name: "bsdos-pc", 9 | Columns: 80, 10 | Lines: 25, 11 | Colors: 8, 12 | Bell: "\a", 13 | Clear: "\x1bc", 14 | AttrOff: "\x1b[0;10m", 15 | Underline: "\x1b[4m", 16 | Bold: "\x1b[1m", 17 | Blink: "\x1b[5m", 18 | Reverse: "\x1b[7m", 19 | SetFg: "\x1b[3%p1%dm", 20 | SetBg: "\x1b[4%p1%dm", 21 | SetFgBg: "\x1b[3%p1%d;4%p2%dm", 22 | PadChar: "\x00", 23 | AltChars: "+\x0020,\x0021-\x0030.\x190333`\x0004a261f370g361h260j331k277l332m300n305o~p304q304r304s_t303u264v301w302x263y363z362{343|330}234~376", 24 | EnterAcs: "\x1b[11m", 25 | ExitAcs: "\x1b[10m", 26 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 27 | CursorBack1: "\b", 28 | CursorUp1: "\x1b[A", 29 | KeyUp: "\x1b[A", 30 | KeyDown: "\x1b[B", 31 | KeyRight: "\x1b[C", 32 | KeyLeft: "\x1b[D", 33 | KeyInsert: "\x1b[L", 34 | KeyBackspace: "\b", 35 | KeyHome: "\x1b[H", 36 | KeyPgUp: "\x1b[I", 37 | KeyPgDn: "\x1b[G", 38 | }) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/encoding/ascii.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Garrett D'Amore 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use file except in compliance with the License. 5 | // You may obtain a copy of the license at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package encoding 16 | 17 | import ( 18 | "golang.org/x/text/encoding" 19 | ) 20 | 21 | // ASCII represents the 7-bit US-ASCII scheme. It decodes directly to 22 | // UTF-8 without change, as all ASCII values are legal UTF-8. 23 | // Unicode values less than 128 (i.e. 7 bits) map 1:1 with ASCII. 24 | // It encodes runes outside of that to 0x1A, the ASCII substitution character. 25 | var ASCII encoding.Encoding 26 | 27 | func init() { 28 | amap := make(map[byte]rune) 29 | for i := 128; i <= 255; i++ { 30 | amap[byte(i)] = RuneError 31 | } 32 | 33 | cm := &Charmap{Map: amap} 34 | cm.Init() 35 | ASCII = cm 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/encoding/README.md: -------------------------------------------------------------------------------- 1 | ## encoding 2 | 3 | [![Linux Status](https://img.shields.io/travis/gdamore/encoding.svg?label=linux)](https://travis-ci.org/gdamore/encoding) 4 | [![Windows Status](https://img.shields.io/appveyor/ci/gdamore/encoding.svg?label=windows)](https://ci.appveyor.com/project/gdamore/encoding) 5 | [![Apache License](https://img.shields.io/badge/license-APACHE2-blue.svg)](https://github.com/gdamore/encoding/blob/master/LICENSE) 6 | [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/gdamore/encoding) 7 | [![Go Report Card](http://goreportcard.com/badge/gdamore/encoding)](http://goreportcard.com/report/gdamore/encoding) 8 | 9 | Package encoding provides a number of encodings that are missing from the 10 | standard Go [encoding]("https://godoc.org/golang.org/x/text/encoding") package. 11 | 12 | We hope that we can contribute these to the standard Go library someday. It 13 | turns out that some of these are useful for dealing with I/O streams coming 14 | from non-UTF friendly sources. 15 | 16 | The UTF8 Encoder is also useful for situations where valid UTF-8 might be 17 | carried in streams that contain non-valid UTF; in particular I use it for 18 | helping me cope with terminals that embed escape sequences in otherwise 19 | valid UTF-8. 20 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_sun.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // Sun Microsystems Inc. workstation console 7 | AddTerminfo(&Terminfo{ 8 | Name: "sun", 9 | Aliases: []string{"sun1", "sun2"}, 10 | Columns: 80, 11 | Lines: 34, 12 | Bell: "\a", 13 | Clear: "\f", 14 | AttrOff: "\x1b[m", 15 | Reverse: "\x1b[7m", 16 | PadChar: "\x00", 17 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 18 | CursorBack1: "\b", 19 | CursorUp1: "\x1b[A", 20 | KeyUp: "\x1b[A", 21 | KeyDown: "\x1b[B", 22 | KeyRight: "\x1b[C", 23 | KeyLeft: "\x1b[D", 24 | KeyDelete: "177", 25 | KeyBackspace: "\b", 26 | KeyHome: "\x1b[214z", 27 | KeyEnd: "\x1b[220z", 28 | KeyPgUp: "\x1b[216z", 29 | KeyPgDn: "\x1b[222z", 30 | KeyF1: "\x1b[224z", 31 | KeyF2: "\x1b[225z", 32 | KeyF3: "\x1b[226z", 33 | KeyF4: "\x1b[227z", 34 | KeyF5: "\x1b[228z", 35 | KeyF6: "\x1b[229z", 36 | KeyF7: "\x1b[230z", 37 | KeyF8: "\x1b[231z", 38 | KeyF9: "\x1b[232z", 39 | KeyF10: "\x1b[233z", 40 | KeyF11: "\x1b[234z", 41 | KeyF12: "\x1b[235z", 42 | }) 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/tscreen_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | // Copyright 2015 The TCell Authors 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use file except in compliance with the License. 7 | // You may obtain a copy of the license at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | package tcell 18 | 19 | // On Windows we don't have support for termios. We probably could, and 20 | // may should, in a cygwin type environment. Its not clear how to make 21 | // this all work nicely with both cygwin and Windows console, so we 22 | // decline to do so here. 23 | 24 | func (t *tScreen) termioInit() error { 25 | return ErrNoScreen 26 | } 27 | 28 | func (t *tScreen) termioFini() { 29 | return 30 | } 31 | 32 | func (t *tScreen) getWinSize() (int, int, error) { 33 | return 0, 0, ErrNoScreen 34 | } 35 | 36 | func (t *tScreen) getCharset() string { 37 | return "UTF-16LE" 38 | } 39 | 40 | type termiosPrivate struct{} 41 | -------------------------------------------------------------------------------- /Gopkg.lock: -------------------------------------------------------------------------------- 1 | # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. 2 | 3 | 4 | [[projects]] 5 | branch = "master" 6 | name = "github.com/gdamore/encoding" 7 | packages = ["."] 8 | revision = "b23993cbb6353f0e6aa98d0ee318a34728f628b9" 9 | 10 | [[projects]] 11 | name = "github.com/gdamore/tcell" 12 | packages = [ 13 | ".", 14 | "terminfo" 15 | ] 16 | revision = "061d51a604c546b48e92253cb65190d76cecf4c6" 17 | version = "v1.0.0" 18 | 19 | [[projects]] 20 | branch = "master" 21 | name = "github.com/lucasb-eyer/go-colorful" 22 | packages = ["."] 23 | revision = "231272389856c976b7500c4fffcc52ddf06ff4eb" 24 | 25 | [[projects]] 26 | name = "github.com/mattn/go-runewidth" 27 | packages = ["."] 28 | revision = "9e777a8366cce605130a531d2cd6363d07ad7317" 29 | version = "v0.0.2" 30 | 31 | [[projects]] 32 | name = "golang.org/x/text" 33 | packages = [ 34 | "encoding", 35 | "encoding/internal/identifier", 36 | "internal/gen", 37 | "transform", 38 | "unicode/cldr" 39 | ] 40 | revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" 41 | version = "v0.3.0" 42 | 43 | [solve-meta] 44 | analyzer-name = "dep" 45 | analyzer-version = 1 46 | inputs-digest = "3c4399e9daf4548023c3bcfcb449ae8a851bf3e3bf0763672e067cc338e02c29" 47 | solver-name = "gps-cdcl" 48 | solver-version = 1 49 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_vt102.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // dec vt102 7 | AddTerminfo(&Terminfo{ 8 | Name: "vt102", 9 | Columns: 80, 10 | Lines: 24, 11 | Bell: "\a", 12 | Clear: "\x1b[H\x1b[J$<50>", 13 | AttrOff: "\x1b[m\x0017$<2>", 14 | Underline: "\x1b[4m$<2>", 15 | Bold: "\x1b[1m$<2>", 16 | Blink: "\x1b[5m$<2>", 17 | Reverse: "\x1b[7m$<2>", 18 | EnterKeypad: "\x1b[?1h\x1b=", 19 | ExitKeypad: "\x1b[?1l\x1b>", 20 | PadChar: "\x00", 21 | AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 22 | EnterAcs: "\x0e", 23 | ExitAcs: "\x0f", 24 | EnableAcs: "\x1b(B\x1b)0", 25 | SetCursor: "\x1b[%i%p1%d;%p2%dH$<5>", 26 | CursorBack1: "\b", 27 | CursorUp1: "\x1b[A$<2>", 28 | KeyUp: "\x1bOA", 29 | KeyDown: "\x1bOB", 30 | KeyRight: "\x1bOC", 31 | KeyLeft: "\x1bOD", 32 | KeyBackspace: "\b", 33 | KeyF1: "\x1bOP", 34 | KeyF2: "\x1bOQ", 35 | KeyF3: "\x1bOR", 36 | KeyF4: "\x1bOS", 37 | KeyF5: "\x1bOt", 38 | KeyF6: "\x1bOu", 39 | KeyF7: "\x1bOv", 40 | KeyF8: "\x1bOl", 41 | KeyF9: "\x1bOw", 42 | KeyF10: "\x1bOx", 43 | }) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/encoding/utf8.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Garrett D'Amore 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use file except in compliance with the License. 5 | // You may obtain a copy of the license at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package encoding 16 | 17 | import ( 18 | "golang.org/x/text/encoding" 19 | ) 20 | 21 | type validUtf8 struct{} 22 | 23 | // UTF8 is an encoding for UTF-8. All it does is verify that the UTF-8 24 | // in is valid. The main reason for its existence is that it will detect 25 | // and report ErrSrcShort or ErrDstShort, whereas the Nop encoding just 26 | // passes every byte, blithely. 27 | var UTF8 encoding.Encoding = validUtf8{} 28 | 29 | func (validUtf8) NewDecoder() *encoding.Decoder { 30 | return &encoding.Decoder{Transformer: encoding.UTF8Validator} 31 | } 32 | 33 | func (validUtf8) NewEncoder() *encoding.Encoder { 34 | return &encoding.Encoder{Transformer: encoding.UTF8Validator} 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_hpterm.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // hp X11 terminal emulator 7 | AddTerminfo(&Terminfo{ 8 | Name: "hpterm", 9 | Aliases: []string{"X-hpterm"}, 10 | Columns: 80, 11 | Lines: 24, 12 | Bell: "\a", 13 | Clear: "\x1b&a0y0C\x1bJ", 14 | AttrOff: "\x1b&d@", 15 | Underline: "\x1b&dD", 16 | Bold: "\x1b&dB", 17 | Dim: "\x1b&dH", 18 | Reverse: "\x1b&dB", 19 | EnterKeypad: "\x1b&s1A", 20 | ExitKeypad: "\x1b&s0A", 21 | PadChar: "\x00", 22 | EnterAcs: "\x0e", 23 | ExitAcs: "\x0f", 24 | SetCursor: "\x1b&a%p1%dy%p2%dC", 25 | CursorBack1: "\b", 26 | CursorUp1: "\x1bA", 27 | KeyUp: "\x1bA", 28 | KeyDown: "\x1bB", 29 | KeyRight: "\x1bC", 30 | KeyLeft: "\x1bD", 31 | KeyInsert: "\x1bQ", 32 | KeyDelete: "\x1bP", 33 | KeyBackspace: "\b", 34 | KeyHome: "\x1bh", 35 | KeyPgUp: "\x1bV", 36 | KeyPgDn: "\x1bU", 37 | KeyF1: "\x1bp", 38 | KeyF2: "\x1bq", 39 | KeyF3: "\x1br", 40 | KeyF4: "\x1bs", 41 | KeyF5: "\x1bt", 42 | KeyF6: "\x1bu", 43 | KeyF7: "\x1bv", 44 | KeyF8: "\x1bw", 45 | KeyClear: "\x1bJ", 46 | }) 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_vt400.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // dec vt400 24x80 column autowrap 7 | AddTerminfo(&Terminfo{ 8 | Name: "vt400", 9 | Aliases: []string{"vt400-24", "dec-vt400"}, 10 | Columns: 80, 11 | Lines: 24, 12 | Clear: "\x1b[H\x1b[J$<10/>", 13 | ShowCursor: "\x1b[?25h", 14 | HideCursor: "\x1b[?25l", 15 | AttrOff: "\x1b[m\x1b(B", 16 | Underline: "\x1b[4m", 17 | Bold: "\x1b[1m", 18 | Blink: "\x1b[5m", 19 | Reverse: "\x1b[7m", 20 | EnterKeypad: "\x1b[?1h\x1b=", 21 | ExitKeypad: "\x1b[?1l\x1b>", 22 | PadChar: "\x00", 23 | AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 24 | EnterAcs: "\x1b(0", 25 | ExitAcs: "\x1b(B", 26 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 27 | CursorBack1: "\b", 28 | CursorUp1: "\x1b[A", 29 | KeyUp: "\x1bOA", 30 | KeyDown: "\x1bOB", 31 | KeyRight: "\x1bOC", 32 | KeyLeft: "\x1bOD", 33 | KeyBackspace: "\b", 34 | KeyF1: "\x1bOP", 35 | KeyF2: "\x1bOQ", 36 | KeyF3: "\x1bOR", 37 | KeyF4: "\x1bOS", 38 | KeyF6: "\x1b[17~", 39 | KeyF7: "\x1b[18~", 40 | KeyF8: "\x1b[19~", 41 | KeyF9: "\x1b[20~", 42 | }) 43 | } 44 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/resize.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The TCell Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use file except in compliance with the License. 5 | // You may obtain a copy of the license at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package tcell 16 | 17 | import ( 18 | "time" 19 | ) 20 | 21 | // EventResize is sent when the window size changes. 22 | type EventResize struct { 23 | t time.Time 24 | w int 25 | h int 26 | } 27 | 28 | // NewEventResize creates an EventResize with the new updated window size, 29 | // which is given in character cells. 30 | func NewEventResize(width, height int) *EventResize { 31 | return &EventResize{t: time.Now(), w: width, h: height} 32 | } 33 | 34 | // When returns the time when the Event was created. 35 | func (ev *EventResize) When() time.Time { 36 | return ev.t 37 | } 38 | 39 | // Size returns the new window size as width, height in character cells. 40 | func (ev *EventResize) Size() (int, int) { 41 | return ev.w, ev.h 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_vt100.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // dec vt100 (w/advanced video) 7 | AddTerminfo(&Terminfo{ 8 | Name: "vt100", 9 | Aliases: []string{"vt100-am"}, 10 | Columns: 80, 11 | Lines: 24, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[J$<50>", 14 | AttrOff: "\x1b[m\x0017$<2>", 15 | Underline: "\x1b[4m$<2>", 16 | Bold: "\x1b[1m$<2>", 17 | Blink: "\x1b[5m$<2>", 18 | Reverse: "\x1b[7m$<2>", 19 | EnterKeypad: "\x1b[?1h\x1b=", 20 | ExitKeypad: "\x1b[?1l\x1b>", 21 | PadChar: "\x00", 22 | AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 23 | EnterAcs: "\x0e", 24 | ExitAcs: "\x0f", 25 | EnableAcs: "\x1b(B\x1b)0", 26 | SetCursor: "\x1b[%i%p1%d;%p2%dH$<5>", 27 | CursorBack1: "\b", 28 | CursorUp1: "\x1b[A$<2>", 29 | KeyUp: "\x1bOA", 30 | KeyDown: "\x1bOB", 31 | KeyRight: "\x1bOC", 32 | KeyLeft: "\x1bOD", 33 | KeyBackspace: "\b", 34 | KeyF1: "\x1bOP", 35 | KeyF2: "\x1bOQ", 36 | KeyF3: "\x1bOR", 37 | KeyF4: "\x1bOS", 38 | KeyF5: "\x1bOt", 39 | KeyF6: "\x1bOu", 40 | KeyF7: "\x1bOv", 41 | KeyF8: "\x1bOl", 42 | KeyF9: "\x1bOw", 43 | KeyF10: "\x1bOx", 44 | }) 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/interrupt.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The TCell Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use file except in compliance with the License. 5 | // You may obtain a copy of the license at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package tcell 16 | 17 | import ( 18 | "time" 19 | ) 20 | 21 | // EventInterrupt is a generic wakeup event. Its can be used to 22 | // to request a redraw. It can carry an arbitrary payload, as well. 23 | type EventInterrupt struct { 24 | t time.Time 25 | v interface{} 26 | } 27 | 28 | // When returns the time when this event was created. 29 | func (ev *EventInterrupt) When() time.Time { 30 | return ev.t 31 | } 32 | 33 | // Data is used to obtain the opaque event payload. 34 | func (ev *EventInterrupt) Data() interface{} { 35 | return ev.v 36 | } 37 | 38 | // NewEventInterrupt creates an EventInterrupt with the given payload. 39 | func NewEventInterrupt(data interface{}) *EventInterrupt { 40 | return &EventInterrupt{t: time.Now(), v: data} 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_sun_color.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // Sun Microsystems Workstation console with color support (IA systems) 7 | AddTerminfo(&Terminfo{ 8 | Name: "sun-color", 9 | Columns: 80, 10 | Lines: 34, 11 | Colors: 8, 12 | Bell: "\a", 13 | Clear: "\f", 14 | AttrOff: "\x1b[m", 15 | Reverse: "\x1b[7m", 16 | SetFg: "\x1b[3%p1%dm", 17 | SetBg: "\x1b[4%p1%dm", 18 | SetFgBg: "\x1b[3%p1%d;4%p2%dm", 19 | PadChar: "\x00", 20 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 21 | CursorBack1: "\b", 22 | CursorUp1: "\x1b[A", 23 | KeyUp: "\x1b[A", 24 | KeyDown: "\x1b[B", 25 | KeyRight: "\x1b[C", 26 | KeyLeft: "\x1b[D", 27 | KeyDelete: "177", 28 | KeyBackspace: "\b", 29 | KeyHome: "\x1b[214z", 30 | KeyEnd: "\x1b[220z", 31 | KeyPgUp: "\x1b[216z", 32 | KeyPgDn: "\x1b[222z", 33 | KeyF1: "\x1b[224z", 34 | KeyF2: "\x1b[225z", 35 | KeyF3: "\x1b[226z", 36 | KeyF4: "\x1b[227z", 37 | KeyF5: "\x1b[228z", 38 | KeyF6: "\x1b[229z", 39 | KeyF7: "\x1b[230z", 40 | KeyF8: "\x1b[231z", 41 | KeyF9: "\x1b[232z", 42 | KeyF10: "\x1b[233z", 43 | KeyF11: "\x1b[234z", 44 | KeyF12: "\x1b[235z", 45 | }) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_vt420.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // DEC VT420 7 | AddTerminfo(&Terminfo{ 8 | Name: "vt420", 9 | Columns: 80, 10 | Lines: 24, 11 | Bell: "\a", 12 | Clear: "\x1b[H\x1b[2J$<50>", 13 | AttrOff: "\x1b[m$<2>", 14 | Underline: "\x1b[4m", 15 | Bold: "\x1b[1m$<2>", 16 | Blink: "\x1b[5m$<2>", 17 | Reverse: "\x1b[7m$<2>", 18 | EnterKeypad: "\x1b=", 19 | ExitKeypad: "\x1b>", 20 | PadChar: "\x00", 21 | AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 22 | EnterAcs: "\x1b(0$<2>", 23 | ExitAcs: "\x1b(B$<4>", 24 | SetCursor: "\x1b[%i%p1%d;%p2%dH$<10>", 25 | CursorBack1: "\b", 26 | CursorUp1: "\x1b[A", 27 | KeyUp: "\x1b[A", 28 | KeyDown: "\x1b[B", 29 | KeyRight: "\x1b[C", 30 | KeyLeft: "\x1b[D", 31 | KeyInsert: "\x1b[2~", 32 | KeyDelete: "\x1b[3~", 33 | KeyBackspace: "\b", 34 | KeyPgUp: "\x1b[5~", 35 | KeyPgDn: "\x1b[6~", 36 | KeyF1: "\x1bOP", 37 | KeyF2: "\x1bOQ", 38 | KeyF3: "\x1bOR", 39 | KeyF4: "\x1bOS", 40 | KeyF5: "\x1b[17~", 41 | KeyF6: "\x1b[18~", 42 | KeyF7: "\x1b[19~", 43 | KeyF8: "\x1b[20~", 44 | KeyF9: "\x1b[21~", 45 | KeyF10: "\x1b[29~", 46 | }) 47 | } 48 | -------------------------------------------------------------------------------- /row.go: -------------------------------------------------------------------------------- 1 | package gobless 2 | 3 | import ( 4 | "math" 5 | ) 6 | 7 | type Row struct { 8 | columns []*Column 9 | width int 10 | height int 11 | x int 12 | y int 13 | gridSize GridSize 14 | } 15 | 16 | func NewRow(size GridSize, columns ...*Column) *Row { 17 | return &Row{ 18 | columns: columns, 19 | gridSize: size, 20 | } 21 | } 22 | 23 | func (row *Row) SetWidth(w int) { 24 | row.width = w 25 | } 26 | func (row *Row) SetHeight(h int) { 27 | row.height = h 28 | } 29 | 30 | func (row *Row) SetX(x int) { 31 | row.x = x 32 | } 33 | func (row *Row) SetY(y int) { 34 | row.y = y 35 | } 36 | func (row *Row) GetTiles(gui *GUI) []Tile { 37 | 38 | tiles := []Tile{} 39 | 40 | colWidth := float64(row.width) / 12 41 | 42 | flSum := 0.0 43 | 44 | colOffset := row.x 45 | 46 | for _, col := range row.columns { 47 | 48 | flWidth := colWidth * float64(col.size) 49 | col.width = int(math.Floor(flWidth)) 50 | flSum += (flWidth - float64(col.width)) 51 | 52 | col.x = colOffset 53 | col.y = row.y 54 | colOffset += col.width 55 | 56 | if flSum >= 0.999 { // avoid floating point fun :/ 57 | flSum-- 58 | col.width = col.width + 1 59 | 60 | } 61 | 62 | col.height = row.height 63 | col.rowHeight = int(math.Floor(float64(row.height) / float64(len(col.components)))) 64 | col.firstRowHeight = col.rowHeight + (row.height - (len(col.components) * col.rowHeight)) 65 | 66 | tiles = append(tiles, col.GetTiles(gui)...) 67 | } 68 | 69 | return tiles 70 | } 71 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_beterm.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // BeOS Terminal 7 | AddTerminfo(&Terminfo{ 8 | Name: "beterm", 9 | Columns: 80, 10 | Lines: 25, 11 | Colors: 8, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[J", 14 | AttrOff: "\x1b[0;10m", 15 | Underline: "\x1b[4m", 16 | Bold: "\x1b[1m", 17 | Reverse: "\x1b[7m", 18 | EnterKeypad: "\x1b[?4h", 19 | ExitKeypad: "\x1b[?4l", 20 | SetFg: "\x1b[3%p1%dm", 21 | SetBg: "\x1b[4%p1%dm", 22 | SetFgBg: "\x1b[3%p1%d;4%p2%dm", 23 | PadChar: "\x00", 24 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 25 | CursorBack1: "\b", 26 | CursorUp1: "\x1b[A", 27 | KeyUp: "\x1b[A", 28 | KeyDown: "\x1b[B", 29 | KeyRight: "\x1b[C", 30 | KeyLeft: "\x1b[D", 31 | KeyInsert: "\x1b[2~", 32 | KeyDelete: "\x1b[3~", 33 | KeyBackspace: "\b", 34 | KeyHome: "\x1b[1~", 35 | KeyEnd: "\x1b[4~", 36 | KeyPgUp: "\x1b[5~", 37 | KeyPgDn: "\x1b[6~", 38 | KeyF1: "\x1b[11~", 39 | KeyF2: "\x1b[12~", 40 | KeyF3: "\x1b[13~", 41 | KeyF4: "\x1b[14~", 42 | KeyF5: "\x1b[15~", 43 | KeyF6: "\x1b[16~", 44 | KeyF7: "\x1b[17~", 45 | KeyF8: "\x1b[18~", 46 | KeyF9: "\x1b[19~", 47 | KeyF10: "\x1b[20~", 48 | KeyF11: "\x1b[21~", 49 | KeyF12: "\x1b[22~", 50 | }) 51 | } 52 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/charset_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows,!nacl,!plan9 2 | 3 | // Copyright 2016 The TCell Authors 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use file except in compliance with the License. 7 | // You may obtain a copy of the license at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | package tcell 18 | 19 | import ( 20 | "os" 21 | "strings" 22 | ) 23 | 24 | func getCharset() string { 25 | // Determine the character set. This can help us later. 26 | // Per POSIX, we search for LC_ALL first, then LC_CTYPE, and 27 | // finally LANG. First one set wins. 28 | locale := "" 29 | if locale = os.Getenv("LC_ALL"); locale == "" { 30 | if locale = os.Getenv("LC_CTYPE"); locale == "" { 31 | locale = os.Getenv("LANG") 32 | } 33 | } 34 | if locale == "POSIX" || locale == "C" { 35 | return "US-ASCII" 36 | } 37 | if i := strings.IndexRune(locale, '@'); i >= 0 { 38 | locale = locale[:i] 39 | } 40 | if i := strings.IndexRune(locale, '.'); i >= 0 { 41 | locale = locale[i+1:] 42 | } else { 43 | // Default assumption, and on Linux we can see LC_ALL 44 | // without a character set, which we assume implies UTF-8. 45 | return "UTF-8" 46 | } 47 | // XXX: add support for aliases 48 | return locale 49 | } 50 | -------------------------------------------------------------------------------- /column.go: -------------------------------------------------------------------------------- 1 | package gobless 2 | 3 | type Column struct { 4 | components []Component 5 | width int 6 | height int 7 | size GridSize 8 | x int 9 | y int 10 | firstRowHeight int 11 | rowHeight int 12 | } 13 | 14 | type GridSize int 15 | 16 | const ( 17 | GridSizeFull GridSize = 12 18 | GridSizeFiveSixths GridSize = 10 19 | GridSizeThreeQuarters GridSize = 9 20 | GridSizeTwoThirds GridSize = 8 21 | GridSizeHalf GridSize = 6 22 | GridSizeOneThird GridSize = 4 23 | GridSizeOneQuarter GridSize = 3 24 | GridSizeOneSixth GridSize = 2 25 | ) 26 | 27 | func NewColumn(size GridSize, components ...Component) *Column { 28 | return &Column{ 29 | components: components, 30 | size: size, 31 | rowHeight: 10, 32 | } 33 | } 34 | 35 | func (col *Column) SetX(x int) { 36 | col.x = x 37 | } 38 | func (col *Column) SetY(y int) { 39 | col.y = y 40 | } 41 | func (col *Column) SetWidth(w int) { 42 | col.width = w 43 | } 44 | func (col *Column) SetHeight(h int) { 45 | col.height = h 46 | } 47 | 48 | func (col *Column) GetTiles(gui *GUI) []Tile { 49 | tiles := []Tile{} 50 | 51 | yOffset := 0 52 | 53 | for i, component := range col.components { 54 | 55 | component.SetX(col.x) 56 | component.SetY(col.y + yOffset) 57 | component.SetWidth(col.width) 58 | if i == 0 { 59 | component.SetHeight(col.firstRowHeight) 60 | yOffset += col.firstRowHeight 61 | } else { 62 | component.SetHeight(col.rowHeight) 63 | yOffset += col.rowHeight 64 | } 65 | 66 | tiles = append(tiles, component.GetTiles(gui)...) 67 | } 68 | 69 | return tiles 70 | } 71 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_vt220.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // dec vt220 7 | AddTerminfo(&Terminfo{ 8 | Name: "vt220", 9 | Aliases: []string{"vt200"}, 10 | Columns: 80, 11 | Lines: 24, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[J", 14 | AttrOff: "\x1b[m\x1b(B", 15 | Underline: "\x1b[4m", 16 | Bold: "\x1b[1m", 17 | Blink: "\x1b[5m", 18 | Reverse: "\x1b[7m", 19 | PadChar: "\x00", 20 | AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 21 | EnterAcs: "\x1b(0$<2>", 22 | ExitAcs: "\x1b(B$<4>", 23 | EnableAcs: "\x1b)0", 24 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 25 | CursorBack1: "\b", 26 | CursorUp1: "\x1b[A", 27 | KeyUp: "\x1b[A", 28 | KeyDown: "\x1b[B", 29 | KeyRight: "\x1b[C", 30 | KeyLeft: "\x1b[D", 31 | KeyInsert: "\x1b[2~", 32 | KeyBackspace: "\b", 33 | KeyPgUp: "\x1b[5~", 34 | KeyPgDn: "\x1b[6~", 35 | KeyF1: "\x1bOP", 36 | KeyF2: "\x1bOQ", 37 | KeyF3: "\x1bOR", 38 | KeyF4: "\x1bOS", 39 | KeyF6: "\x1b[17~", 40 | KeyF7: "\x1b[18~", 41 | KeyF8: "\x1b[19~", 42 | KeyF9: "\x1b[20~", 43 | KeyF10: "\x1b[21~", 44 | KeyF11: "\x1b[23~", 45 | KeyF12: "\x1b[24~", 46 | KeyF13: "\x1b[25~", 47 | KeyF14: "\x1b[26~", 48 | KeyF17: "\x1b[31~", 49 | KeyF18: "\x1b[32~", 50 | KeyF19: "\x1b[33~", 51 | KeyF20: "\x1b[34~", 52 | KeyHelp: "\x1b[28~", 53 | }) 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_wy50.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // Wyse 50 7 | AddTerminfo(&Terminfo{ 8 | Name: "wy50", 9 | Aliases: []string{"wyse50"}, 10 | Columns: 80, 11 | Lines: 24, 12 | Bell: "\a", 13 | Clear: "\x1b+$<20>", 14 | ShowCursor: "\x1b`1", 15 | HideCursor: "\x1b`0", 16 | AttrOff: "\x1b(\x1bH\x0003", 17 | Dim: "\x1b`7\x1b)", 18 | Reverse: "\x1b`6\x1b)", 19 | PadChar: "\x00", 20 | AltChars: "0wa_h[jukslrmqnxqzttuyv]wpxv", 21 | EnterAcs: "\x1bH\x02", 22 | ExitAcs: "\x1bH\x03", 23 | SetCursor: "\x1b=%p1%' '%+%c%p2%' '%+%c", 24 | CursorBack1: "\b", 25 | CursorUp1: "\v", 26 | KeyUp: "\v", 27 | KeyDown: "\n", 28 | KeyRight: "\f", 29 | KeyLeft: "\b", 30 | KeyInsert: "\x1bQ", 31 | KeyDelete: "\x1bW", 32 | KeyBackspace: "\b", 33 | KeyHome: "\x1e", 34 | KeyPgUp: "\x1bJ", 35 | KeyPgDn: "\x1bK", 36 | KeyF1: "\x01@\r", 37 | KeyF2: "\x01A\r", 38 | KeyF3: "\x01B\r", 39 | KeyF4: "\x01C\r", 40 | KeyF5: "\x01D\r", 41 | KeyF6: "\x01E\r", 42 | KeyF7: "\x01F\r", 43 | KeyF8: "\x01G\r", 44 | KeyF9: "\x01H\r", 45 | KeyF10: "\x01I\r", 46 | KeyF11: "\x01J\r", 47 | KeyF12: "\x01K\r", 48 | KeyF13: "\x01L\r", 49 | KeyF14: "\x01M\r", 50 | KeyF15: "\x01N\r", 51 | KeyF16: "\x01O\r", 52 | KeyPrint: "\x1bP", 53 | KeyBacktab: "\x1bI", 54 | KeyShfHome: "\x1b{", 55 | }) 56 | } 57 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/colorfit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The TCell Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use file except in compliance with the License. 5 | // You may obtain a copy of the license at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package tcell 16 | 17 | import ( 18 | "github.com/lucasb-eyer/go-colorful" 19 | "math" 20 | ) 21 | 22 | // FindColor attempts to find a given color, or the best match possible for it, 23 | // from the palette given. This is an expensive operation, so results should 24 | // be cached by the caller. 25 | func FindColor(c Color, palette []Color) Color { 26 | match := ColorDefault 27 | dist := float64(0) 28 | r, g, b := c.RGB() 29 | c1 := colorful.Color{ 30 | R: float64(r) / 255.0, 31 | G: float64(g) / 255.0, 32 | B: float64(b) / 255.0, 33 | } 34 | for _, d := range palette { 35 | r, g, b = d.RGB() 36 | c2 := colorful.Color{ 37 | R: float64(r) / 255.0, 38 | G: float64(g) / 255.0, 39 | B: float64(b) / 255.0, 40 | } 41 | // CIE94 is more accurate, but really really expensive. 42 | nd := c1.DistanceCIE76(c2) 43 | if math.IsNaN(nd) { 44 | nd = math.Inf(1) 45 | } 46 | if match == ColorDefault || nd < dist { 47 | match = d 48 | dist = nd 49 | } 50 | } 51 | return match 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/lucasb-eyer/go-colorful/colorgens.go: -------------------------------------------------------------------------------- 1 | // Various ways to generate single random colors 2 | 3 | package colorful 4 | 5 | import ( 6 | "math/rand" 7 | ) 8 | 9 | // Creates a random dark, "warm" color through a restricted HSV space. 10 | func FastWarmColor() Color { 11 | return Hsv( 12 | rand.Float64() * 360.0, 13 | 0.5 + rand.Float64()*0.3, 14 | 0.3 + rand.Float64()*0.3) 15 | } 16 | 17 | // Creates a random dark, "warm" color through restricted HCL space. 18 | // This is slower than FastWarmColor but will likely give you colors which have 19 | // the same "warmness" if you run it many times. 20 | func WarmColor() (c Color) { 21 | for c = randomWarm() ; !c.IsValid() ; c = randomWarm() {} 22 | return 23 | } 24 | 25 | func randomWarm() Color { 26 | return Hcl( 27 | rand.Float64() * 360.0, 28 | 0.1 + rand.Float64()*0.3, 29 | 0.2 + rand.Float64()*0.3) 30 | } 31 | 32 | // Creates a random bright, "pimpy" color through a restricted HSV space. 33 | func FastHappyColor() Color { 34 | return Hsv( 35 | rand.Float64() * 360.0, 36 | 0.7 + rand.Float64()*0.3, 37 | 0.6 + rand.Float64()*0.3) 38 | } 39 | 40 | // Creates a random bright, "pimpy" color through restricted HCL space. 41 | // This is slower than FastHappyColor but will likely give you colors which 42 | // have the same "brightness" if you run it many times. 43 | func HappyColor() (c Color) { 44 | for c = randomPimp() ; !c.IsValid() ; c = randomPimp() {} 45 | return 46 | } 47 | 48 | func randomPimp() Color { 49 | return Hcl( 50 | rand.Float64() * 360.0, 51 | 0.5 + rand.Float64()*0.3, 52 | 0.5 + rand.Float64()*0.3) 53 | } 54 | 55 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/runewidth_posix.go: -------------------------------------------------------------------------------- 1 | // +build !windows,!js 2 | 3 | package runewidth 4 | 5 | import ( 6 | "os" 7 | "regexp" 8 | "strings" 9 | ) 10 | 11 | var reLoc = regexp.MustCompile(`^[a-z][a-z][a-z]?(?:_[A-Z][A-Z])?\.(.+)`) 12 | 13 | var mblenTable = map[string]int{ 14 | "utf-8": 6, 15 | "utf8": 6, 16 | "jis": 8, 17 | "eucjp": 3, 18 | "euckr": 2, 19 | "euccn": 2, 20 | "sjis": 2, 21 | "cp932": 2, 22 | "cp51932": 2, 23 | "cp936": 2, 24 | "cp949": 2, 25 | "cp950": 2, 26 | "big5": 2, 27 | "gbk": 2, 28 | "gb2312": 2, 29 | } 30 | 31 | func isEastAsian(locale string) bool { 32 | charset := strings.ToLower(locale) 33 | r := reLoc.FindStringSubmatch(locale) 34 | if len(r) == 2 { 35 | charset = strings.ToLower(r[1]) 36 | } 37 | 38 | if strings.HasSuffix(charset, "@cjk_narrow") { 39 | return false 40 | } 41 | 42 | for pos, b := range []byte(charset) { 43 | if b == '@' { 44 | charset = charset[:pos] 45 | break 46 | } 47 | } 48 | max := 1 49 | if m, ok := mblenTable[charset]; ok { 50 | max = m 51 | } 52 | if max > 1 && (charset[0] != 'u' || 53 | strings.HasPrefix(locale, "ja") || 54 | strings.HasPrefix(locale, "ko") || 55 | strings.HasPrefix(locale, "zh")) { 56 | return true 57 | } 58 | return false 59 | } 60 | 61 | // IsEastAsian return true if the current locale is CJK 62 | func IsEastAsian() bool { 63 | locale := os.Getenv("LC_CTYPE") 64 | if locale == "" { 65 | locale = os.Getenv("LANG") 66 | } 67 | 68 | // ignore C locale 69 | if locale == "POSIX" || locale == "C" { 70 | return false 71 | } 72 | if len(locale) > 1 && locale[0] == 'C' && (locale[1] == '.' || locale[1] == '-') { 73 | return false 74 | } 75 | 76 | return isEastAsian(locale) 77 | } 78 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/event.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The TCell Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use file except in compliance with the License. 5 | // You may obtain a copy of the license at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package tcell 16 | 17 | import ( 18 | "time" 19 | ) 20 | 21 | // Event is a generic interface used for passing around Events. 22 | // Concrete types follow. 23 | type Event interface { 24 | // When reports the time when the event was generated. 25 | When() time.Time 26 | } 27 | 28 | // EventTime is a simple base event class, suitable for easy reuse. 29 | // It can be used to deliver actual timer events as well. 30 | type EventTime struct { 31 | when time.Time 32 | } 33 | 34 | // When returns the time stamp when the event occurred. 35 | func (e *EventTime) When() time.Time { 36 | return e.when 37 | } 38 | 39 | // SetEventTime sets the time of occurrence for the event. 40 | func (e *EventTime) SetEventTime(t time.Time) { 41 | e.when = t 42 | } 43 | 44 | // SetEventNow sets the time of occurrence for the event to the current time. 45 | func (e *EventTime) SetEventNow() { 46 | e.SetEventTime(time.Now()) 47 | } 48 | 49 | // EventHandler is anything that handles events. If the handler has 50 | // consumed the event, it should return true. False otherwise. 51 | type EventHandler interface { 52 | HandleEvent(Event) bool 53 | } 54 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_wy60.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // Wyse 60 7 | AddTerminfo(&Terminfo{ 8 | Name: "wy60", 9 | Aliases: []string{"wyse60"}, 10 | Columns: 80, 11 | Lines: 24, 12 | Bell: "\a", 13 | Clear: "\x1b+$<100>", 14 | EnterCA: "\x1bw0", 15 | ExitCA: "\x1bw1", 16 | ShowCursor: "\x1b`1", 17 | HideCursor: "\x1b`0", 18 | AttrOff: "\x1b(\x1bH\x0003\x1bG0\x1bcD", 19 | Underline: "\x1bG8", 20 | Dim: "\x1bGp", 21 | Blink: "\x1bG2", 22 | Reverse: "\x1bG4", 23 | PadChar: "\x00", 24 | AltChars: "+/,.0[a2fxgqh1ihjYk?lZm@nEqDtCu4vAwBx3yszr{c~~", 25 | EnterAcs: "\x1bcE", 26 | ExitAcs: "\x1bcD", 27 | SetCursor: "\x1b=%p1%' '%+%c%p2%' '%+%c", 28 | CursorBack1: "\b", 29 | CursorUp1: "\v", 30 | KeyUp: "\v", 31 | KeyDown: "\n", 32 | KeyRight: "\f", 33 | KeyLeft: "\b", 34 | KeyInsert: "\x1bQ", 35 | KeyDelete: "\x1bW", 36 | KeyBackspace: "\b", 37 | KeyHome: "\x1e", 38 | KeyPgUp: "\x1bJ", 39 | KeyPgDn: "\x1bK", 40 | KeyF1: "\x01@\r", 41 | KeyF2: "\x01A\r", 42 | KeyF3: "\x01B\r", 43 | KeyF4: "\x01C\r", 44 | KeyF5: "\x01D\r", 45 | KeyF6: "\x01E\r", 46 | KeyF7: "\x01F\r", 47 | KeyF8: "\x01G\r", 48 | KeyF9: "\x01H\r", 49 | KeyF10: "\x01I\r", 50 | KeyF11: "\x01J\r", 51 | KeyF12: "\x01K\r", 52 | KeyF13: "\x01L\r", 53 | KeyF14: "\x01M\r", 54 | KeyF15: "\x01N\r", 55 | KeyF16: "\x01O\r", 56 | KeyPrint: "\x1bP", 57 | KeyBacktab: "\x1bI", 58 | KeyShfHome: "\x1b{", 59 | }) 60 | } 61 | -------------------------------------------------------------------------------- /donut.go: -------------------------------------------------------------------------------- 1 | package gobless 2 | 3 | import "math" 4 | 5 | type Donut struct { 6 | width int 7 | height int 8 | x int 9 | y int 10 | style Style 11 | pc int 12 | label string 13 | } 14 | 15 | func NewDonut() *Donut { 16 | return &Donut{ 17 | style: DefaultStyle, 18 | } 19 | } 20 | 21 | func (donut *Donut) SetPercent(pc int) { 22 | donut.pc = pc 23 | } 24 | func (donut *Donut) SetLabel(label string) { 25 | donut.label = label 26 | } 27 | func (donut *Donut) SetX(x int) { 28 | donut.x = x 29 | } 30 | func (donut *Donut) SetY(y int) { 31 | donut.y = y 32 | } 33 | func (donut *Donut) SetWidth(w int) { 34 | donut.width = w 35 | } 36 | func (donut *Donut) SetHeight(h int) { 37 | donut.height = h 38 | } 39 | func (donut *Donut) SetStyle(style Style) { 40 | donut.style = style 41 | } 42 | 43 | func (donut *Donut) GetTiles(gui *GUI) []Tile { 44 | 45 | dm := NewDotMatrix() 46 | dm.SetWidth(donut.width) 47 | dm.SetHeight(donut.height) 48 | 49 | cX := donut.width 50 | cY := donut.height 51 | 52 | finalAngle := float64(donut.pc) * 360.0 53 | 54 | maxRadius := cX 55 | if maxRadius > cY { 56 | maxRadius = cY 57 | } 58 | 59 | for radius := 1; radius <= maxRadius; radius++ { 60 | 61 | inc := 2.0 / float64(radius) 62 | 63 | c2 := float64(radius * radius) 64 | 65 | for deg := 0.0; deg < finalAngle; deg += inc { 66 | subRad := math.Mod(deg, 90.0) * (math.Pi / 180) 67 | y := math.Sin(subRad) * float64(radius) 68 | x := math.Sqrt(c2 - (y * y)) 69 | 70 | switch true { 71 | case deg > 270: 72 | x = x * -1 73 | y = y * -1 74 | case deg > 180: 75 | x = x * -1 76 | case deg > 90: 77 | case deg > 0: 78 | y = y * -1 79 | } 80 | 81 | dm.Line(cX, cY, cX+int(math.Round(x)), cY+int(math.Round(y)), ColorRed) 82 | } 83 | } 84 | 85 | return dm.GetTiles(gui) 86 | } 87 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_wy99_ansi.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // Wyse WY-99GT in ansi mode (int'l PC keyboard) 7 | AddTerminfo(&Terminfo{ 8 | Name: "wy99-ansi", 9 | Columns: 80, 10 | Lines: 25, 11 | Bell: "\a", 12 | Clear: "\x1b[H\x1b[J$<200>", 13 | ShowCursor: "\x1b[34h\x1b[?25h", 14 | HideCursor: "\x1b[?25l", 15 | AttrOff: "\x1b[m\x0017\x1b[\"q", 16 | Underline: "\x1b[4m", 17 | Bold: "\x1b[1m", 18 | Dim: "\x1b[2m", 19 | Blink: "\x1b[5m", 20 | Reverse: "\x1b[7m", 21 | EnterKeypad: "\x1b[?1h", 22 | ExitKeypad: "\x1b[?1l", 23 | PadChar: "\x00", 24 | AltChars: "``aaffggjjkkllmmnnooqqssttuuvvwwxx{{||}}~~", 25 | EnterAcs: "\x0e", 26 | ExitAcs: "\x0f", 27 | EnableAcs: "\x1b)0", 28 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 29 | CursorBack1: "\x0010$<1>", 30 | CursorUp1: "\x1bM", 31 | KeyUp: "\x1bOA", 32 | KeyDown: "\x1bOB", 33 | KeyRight: "\x1bOC", 34 | KeyLeft: "\x1bOD", 35 | KeyBackspace: "\b", 36 | KeyF1: "\x1bOP", 37 | KeyF2: "\x1bOQ", 38 | KeyF3: "\x1bOR", 39 | KeyF4: "\x1bOS", 40 | KeyF5: "\x1b[M", 41 | KeyF6: "\x1b[17~", 42 | KeyF7: "\x1b[18~", 43 | KeyF8: "\x1b[19~", 44 | KeyF9: "\x1b[20~", 45 | KeyF10: "\x1b[21~", 46 | KeyF11: "\x1b[23~", 47 | KeyF12: "\x1b[24~", 48 | KeyF17: "\x1b[K", 49 | KeyF18: "\x1b[31~", 50 | KeyF19: "\x1b[32~", 51 | KeyF20: "\x1b[33~", 52 | KeyF21: "\x1b[34~", 53 | KeyF22: "\x1b[35~", 54 | KeyF23: "\x1b[1~", 55 | KeyF24: "\x1b[2~", 56 | KeyBacktab: "\x1b[z", 57 | }) 58 | } 59 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_wy99a_ansi.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // Wyse WY-99GT in ansi mode (US PC keyboard) 7 | AddTerminfo(&Terminfo{ 8 | Name: "wy99a-ansi", 9 | Columns: 80, 10 | Lines: 25, 11 | Bell: "\a", 12 | Clear: "\x1b[H\x1b[J$<200>", 13 | ShowCursor: "\x1b[34h\x1b[?25h", 14 | HideCursor: "\x1b[?25l", 15 | AttrOff: "\x1b[m\x0017\x1b[\"q", 16 | Underline: "\x1b[4m", 17 | Bold: "\x1b[1m", 18 | Dim: "\x1b[2m", 19 | Blink: "\x1b[5m", 20 | Reverse: "\x1b[7m", 21 | EnterKeypad: "\x1b[?1h", 22 | ExitKeypad: "\x1b[?1l", 23 | PadChar: "\x00", 24 | AltChars: "``aaffggjjkkllmmnnooqqssttuuvvwwxx{{||}}~~", 25 | EnterAcs: "\x0e", 26 | ExitAcs: "\x0f", 27 | EnableAcs: "\x1b)0", 28 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 29 | CursorBack1: "\x0010$<1>", 30 | CursorUp1: "\x1bM", 31 | KeyUp: "\x1bOA", 32 | KeyDown: "\x1bOB", 33 | KeyRight: "\x1bOC", 34 | KeyLeft: "\x1bOD", 35 | KeyBackspace: "\b", 36 | KeyF1: "\x1bOP", 37 | KeyF2: "\x1bOQ", 38 | KeyF3: "\x1bOR", 39 | KeyF4: "\x1bOS", 40 | KeyF5: "\x1b[M", 41 | KeyF6: "\x1b[17~", 42 | KeyF7: "\x1b[18~", 43 | KeyF8: "\x1b[19~", 44 | KeyF9: "\x1b[20~", 45 | KeyF10: "\x1b[21~", 46 | KeyF11: "\x1b[23~", 47 | KeyF12: "\x1b[24~", 48 | KeyF17: "\x1b[K", 49 | KeyF18: "\x1b[31~", 50 | KeyF19: "\x1b[32~", 51 | KeyF20: "\x1b[33~", 52 | KeyF21: "\x1b[34~", 53 | KeyF22: "\x1b[35~", 54 | KeyF23: "\x1b[1~", 55 | KeyF24: "\x1b[2~", 56 | KeyBacktab: "\x1b[z", 57 | }) 58 | } 59 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_vt320.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // dec vt320 7 bit terminal 7 | AddTerminfo(&Terminfo{ 8 | Name: "vt320", 9 | Aliases: []string{"vt300"}, 10 | Columns: 80, 11 | Lines: 24, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[2J", 14 | ShowCursor: "\x1b[?25h", 15 | HideCursor: "\x1b[?25l", 16 | AttrOff: "\x1b[m\x1b(B", 17 | Underline: "\x1b[4m", 18 | Bold: "\x1b[1m", 19 | Blink: "\x1b[5m", 20 | Reverse: "\x1b[7m", 21 | EnterKeypad: "\x1b[?1h\x1b=", 22 | ExitKeypad: "\x1b[?1l\x1b>", 23 | PadChar: "\x00", 24 | AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 25 | EnterAcs: "\x1b(0", 26 | ExitAcs: "\x1b(B", 27 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 28 | CursorBack1: "\b", 29 | CursorUp1: "\x1b[A", 30 | KeyUp: "\x1bOA", 31 | KeyDown: "\x1bOB", 32 | KeyRight: "\x1bOC", 33 | KeyLeft: "\x1bOD", 34 | KeyInsert: "\x1b[2~", 35 | KeyDelete: "\x1b[3~", 36 | KeyBackspace: "177", 37 | KeyHome: "\x1b[1~", 38 | KeyPgUp: "\x1b[5~", 39 | KeyPgDn: "\x1b[6~", 40 | KeyF1: "\x1bOP", 41 | KeyF2: "\x1bOQ", 42 | KeyF3: "\x1bOR", 43 | KeyF4: "\x1bOS", 44 | KeyF6: "\x1b[17~", 45 | KeyF7: "\x1b[18~", 46 | KeyF8: "\x1b[19~", 47 | KeyF9: "\x1b[20~", 48 | KeyF10: "\x1b[21~", 49 | KeyF11: "\x1b[23~", 50 | KeyF12: "\x1b[24~", 51 | KeyF13: "\x1b[25~", 52 | KeyF14: "\x1b[26~", 53 | KeyF15: "\x1b[28~", 54 | KeyF16: "\x1b[29~", 55 | KeyF17: "\x1b[31~", 56 | KeyF18: "\x1b[32~", 57 | KeyF19: "\x1b[33~", 58 | KeyF20: "\x1b[34~", 59 | }) 60 | } 61 | -------------------------------------------------------------------------------- /_examples/demo/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "math/rand" 5 | "time" 6 | 7 | "github.com/liamg/gobless" 8 | ) 9 | 10 | func main() { 11 | gui := gobless.NewGUI() 12 | if err := gui.Init(); err != nil { 13 | panic(err) 14 | } 15 | defer gui.Close() 16 | 17 | helloTextbox := gobless.NewTextBox() 18 | helloTextbox.SetText(`Hello World!`) 19 | helloTextbox.SetBorderColor(gobless.ColorGreen) 20 | helloTextbox.SetTitle("Message") 21 | 22 | quitTextbox := gobless.NewTextBox() 23 | quitTextbox.SetText(`Press Ctrl-q to exit.`) 24 | quitTextbox.SetBorderColor(gobless.ColorRed) 25 | 26 | chart := gobless.NewBarChart() 27 | chart.SetTitle("Traffic") 28 | chart.SetBar("Europe", 90) 29 | chart.SetBar("US", 72) 30 | chart.SetBar("Asia", 12) 31 | chart.SetYScale(100) 32 | 33 | row := gobless.NewRow( 34 | gobless.GridSizeHalf, 35 | gobless.NewColumn( 36 | gobless.GridSizeTwoThirds, 37 | helloTextbox, 38 | ), 39 | gobless.NewColumn( 40 | gobless.GridSizeOneThird, 41 | chart, 42 | ), 43 | ) 44 | 45 | lowerRow := gobless.NewRow( 46 | gobless.GridSizeHalf, 47 | gobless.NewColumn( 48 | gobless.GridSizeFull, 49 | quitTextbox, 50 | ), 51 | ) 52 | 53 | gui.Render(row, lowerRow) 54 | 55 | quitChan := make(chan bool) 56 | 57 | rand.Seed(time.Now().UnixNano()) 58 | 59 | go func() { 60 | 61 | for { 62 | select { 63 | case <-time.After(time.Second): 64 | chart.SetBar("Europe", rand.Intn(30)+70) 65 | chart.SetBar("US", rand.Intn(20)+50) 66 | chart.SetBar("Asia", rand.Intn(10)+5) 67 | gui.Render(row, lowerRow) 68 | case <-quitChan: 69 | break 70 | } 71 | } 72 | 73 | }() 74 | 75 | gui.HandleKeyPress(gobless.KeyCtrlQ, func(event gobless.KeyPressEvent) { 76 | quitChan <- true 77 | gui.Close() 78 | }) 79 | 80 | gui.HandleResize(func(event gobless.ResizeEvent) { 81 | gui.Render(row, lowerRow) 82 | }) 83 | 84 | gui.Loop() 85 | } 86 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_cygwin.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // ansi emulation for Cygwin 7 | AddTerminfo(&Terminfo{ 8 | Name: "cygwin", 9 | Colors: 8, 10 | Bell: "\a", 11 | Clear: "\x1b[H\x1b[J", 12 | EnterCA: "\x1b7\x1b[?47h", 13 | ExitCA: "\x1b[2J\x1b[?47l\x1b8", 14 | AttrOff: "\x1b[0;10m", 15 | Underline: "\x1b[4m", 16 | Bold: "\x1b[1m", 17 | Reverse: "\x1b[7m", 18 | SetFg: "\x1b[3%p1%dm", 19 | SetBg: "\x1b[4%p1%dm", 20 | SetFgBg: "\x1b[3%p1%d;4%p2%dm", 21 | PadChar: "\x00", 22 | AltChars: "+\x0020,\x0021-\x0030.\x190333`\x0004a261f370g361h260j331k277l332m300n305o~p304q304r304s_t303u264v301w302x263y363z362{343|330}234~376", 23 | EnterAcs: "\x1b[11m", 24 | ExitAcs: "\x1b[10m", 25 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 26 | CursorBack1: "\b", 27 | CursorUp1: "\x1b[A", 28 | KeyUp: "\x1b[A", 29 | KeyDown: "\x1b[B", 30 | KeyRight: "\x1b[C", 31 | KeyLeft: "\x1b[D", 32 | KeyInsert: "\x1b[2~", 33 | KeyDelete: "\x1b[3~", 34 | KeyBackspace: "\b", 35 | KeyHome: "\x1b[1~", 36 | KeyEnd: "\x1b[4~", 37 | KeyPgUp: "\x1b[5~", 38 | KeyPgDn: "\x1b[6~", 39 | KeyF1: "\x1b[[A", 40 | KeyF2: "\x1b[[B", 41 | KeyF3: "\x1b[[C", 42 | KeyF4: "\x1b[[D", 43 | KeyF5: "\x1b[[E", 44 | KeyF6: "\x1b[17~", 45 | KeyF7: "\x1b[18~", 46 | KeyF8: "\x1b[19~", 47 | KeyF9: "\x1b[20~", 48 | KeyF10: "\x1b[21~", 49 | KeyF11: "\x1b[23~", 50 | KeyF12: "\x1b[24~", 51 | KeyF13: "\x1b[25~", 52 | KeyF14: "\x1b[26~", 53 | KeyF15: "\x1b[28~", 54 | KeyF16: "\x1b[29~", 55 | KeyF17: "\x1b[31~", 56 | KeyF18: "\x1b[32~", 57 | KeyF19: "\x1b[33~", 58 | KeyF20: "\x1b[34~", 59 | }) 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_dtterm.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // CDE desktop terminal 7 | AddTerminfo(&Terminfo{ 8 | Name: "dtterm", 9 | Columns: 80, 10 | Lines: 24, 11 | Colors: 8, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[J", 14 | ShowCursor: "\x1b[?25h", 15 | HideCursor: "\x1b[?25l", 16 | AttrOff: "\x1b[m\x0017", 17 | Underline: "\x1b[4m", 18 | Bold: "\x1b[1m", 19 | Dim: "\x1b[2m", 20 | Blink: "\x1b[5m", 21 | Reverse: "\x1b[7m", 22 | SetFg: "\x1b[3%p1%dm", 23 | SetBg: "\x1b[4%p1%dm", 24 | SetFgBg: "\x1b[3%p1%d;4%p2%dm", 25 | PadChar: "\x00", 26 | AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 27 | EnterAcs: "\x0e", 28 | ExitAcs: "\x0f", 29 | EnableAcs: "\x1b(B\x1b)0", 30 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 31 | CursorBack1: "\b", 32 | CursorUp1: "\x1b[A", 33 | KeyUp: "\x1b[A", 34 | KeyDown: "\x1b[B", 35 | KeyRight: "\x1b[C", 36 | KeyLeft: "\x1b[D", 37 | KeyInsert: "\x1b[2~", 38 | KeyDelete: "\x1b[3~", 39 | KeyBackspace: "\b", 40 | KeyPgUp: "\x1b[5~", 41 | KeyPgDn: "\x1b[6~", 42 | KeyF1: "\x1b[11~", 43 | KeyF2: "\x1b[12~", 44 | KeyF3: "\x1b[13~", 45 | KeyF4: "\x1b[14~", 46 | KeyF5: "\x1b[15~", 47 | KeyF6: "\x1b[17~", 48 | KeyF7: "\x1b[18~", 49 | KeyF8: "\x1b[19~", 50 | KeyF9: "\x1b[20~", 51 | KeyF10: "\x1b[21~", 52 | KeyF11: "\x1b[23~", 53 | KeyF12: "\x1b[24~", 54 | KeyF13: "\x1b[25~", 55 | KeyF14: "\x1b[26~", 56 | KeyF15: "\x1b[28~", 57 | KeyF16: "\x1b[29~", 58 | KeyF17: "\x1b[31~", 59 | KeyF18: "\x1b[32~", 60 | KeyF19: "\x1b[33~", 61 | KeyF20: "\x1b[34~", 62 | KeyHelp: "\x1b[28~", 63 | }) 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_screen.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // VT 100/ANSI X3.64 virtual terminal 7 | AddTerminfo(&Terminfo{ 8 | Name: "screen", 9 | Columns: 80, 10 | Lines: 24, 11 | Colors: 8, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[J", 14 | EnterCA: "\x1b[?1049h", 15 | ExitCA: "\x1b[?1049l", 16 | ShowCursor: "\x1b[34h\x1b[?25h", 17 | HideCursor: "\x1b[?25l", 18 | AttrOff: "\x1b[m\x0017", 19 | Underline: "\x1b[4m", 20 | Bold: "\x1b[1m", 21 | Blink: "\x1b[5m", 22 | Reverse: "\x1b[7m", 23 | EnterKeypad: "\x1b[?1h\x1b=", 24 | ExitKeypad: "\x1b[?1l\x1b>", 25 | SetFg: "\x1b[3%p1%dm", 26 | SetBg: "\x1b[4%p1%dm", 27 | SetFgBg: "\x1b[3%p1%d;4%p2%dm", 28 | PadChar: "\x00", 29 | AltChars: "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 30 | EnterAcs: "\x0e", 31 | ExitAcs: "\x0f", 32 | EnableAcs: "\x1b(B\x1b)0", 33 | Mouse: "\x1b[M", 34 | MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", 35 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 36 | CursorBack1: "\b", 37 | CursorUp1: "\x1bM", 38 | KeyUp: "\x1bOA", 39 | KeyDown: "\x1bOB", 40 | KeyRight: "\x1bOC", 41 | KeyLeft: "\x1bOD", 42 | KeyInsert: "\x1b[2~", 43 | KeyDelete: "\x1b[3~", 44 | KeyBackspace: "\b", 45 | KeyHome: "\x1b[1~", 46 | KeyEnd: "\x1b[4~", 47 | KeyPgUp: "\x1b[5~", 48 | KeyPgDn: "\x1b[6~", 49 | KeyF1: "\x1bOP", 50 | KeyF2: "\x1bOQ", 51 | KeyF3: "\x1bOR", 52 | KeyF4: "\x1bOS", 53 | KeyF5: "\x1b[15~", 54 | KeyF6: "\x1b[17~", 55 | KeyF7: "\x1b[18~", 56 | KeyF8: "\x1b[19~", 57 | KeyF9: "\x1b[20~", 58 | KeyF10: "\x1b[21~", 59 | KeyF11: "\x1b[23~", 60 | KeyF12: "\x1b[24~", 61 | KeyBacktab: "\x1b[Z", 62 | }) 63 | } 64 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The TCell Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use file except in compliance with the License. 5 | // You may obtain a copy of the license at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package tcell provides a lower-level, portable API for building 16 | // programs that interact with terminals or consoles. It works with 17 | // both common (and many uncommon!) terminals or terminal emulators, 18 | // and Windows console implementations. 19 | // 20 | // It provides support for up to 256 colors, text attributes, and box drawing 21 | // elements. A database of terminals built from a real terminfo database 22 | // is provided, along with code to generate new database entries. 23 | // 24 | // Tcell offers very rich support for mice, dependent upon the terminal 25 | // of course. (Windows, XTerm, and iTerm 2 are known to work very well.) 26 | // 27 | // If the environment is not Unicode by default, such as an ISO8859 based 28 | // locale or GB18030, Tcell can convert input and outupt, so that your 29 | // terminal can operate in whatever locale is most convenient, while the 30 | // application program can just assume "everything is UTF-8". Reasonable 31 | // defaults are used for updating characters to something suitable for 32 | // display. Unicode box drawing characters will be converted to use the 33 | // alternate character set of your terminal, if native conversions are 34 | // not available. If no ACS is available, then some ASCII fallbacks will 35 | // be used. 36 | // 37 | // A rich set of keycodes is supported, with support for up to 65 function 38 | // keys, and various other special keys. 39 | // 40 | package tcell 41 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_kterm.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // kterm kanji terminal emulator (X window system) 7 | AddTerminfo(&Terminfo{ 8 | Name: "kterm", 9 | Columns: 80, 10 | Lines: 24, 11 | Colors: 8, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[2J", 14 | EnterCA: "\x1b7\x1b[?47h", 15 | ExitCA: "\x1b[2J\x1b[?47l\x1b8", 16 | AttrOff: "\x1b[m\x1b(B", 17 | Underline: "\x1b[4m", 18 | Bold: "\x1b[1m", 19 | Reverse: "\x1b[7m", 20 | EnterKeypad: "\x1b[?1h\x1b=", 21 | ExitKeypad: "\x1b[?1l\x1b>", 22 | SetFg: "\x1b[3%p1%dm", 23 | SetBg: "\x1b[4%p1%dm", 24 | SetFgBg: "\x1b[3%p1%d;4%p2%dm", 25 | PadChar: "\x00", 26 | AltChars: "``aajjkkllmmnnooppqqrrssttuuvvwwxx~~", 27 | EnterAcs: "\x1b(0", 28 | ExitAcs: "\x1b(B", 29 | Mouse: "\x1b[M", 30 | MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", 31 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 32 | CursorBack1: "\b", 33 | CursorUp1: "\x1b[A", 34 | KeyUp: "\x1bOA", 35 | KeyDown: "\x1bOB", 36 | KeyRight: "\x1bOC", 37 | KeyLeft: "\x1bOD", 38 | KeyInsert: "\x1b[2~", 39 | KeyDelete: "\x1b[3~", 40 | KeyBackspace: "\b", 41 | KeyPgUp: "\x1b[5~", 42 | KeyPgDn: "\x1b[6~", 43 | KeyF1: "\x1b[11~", 44 | KeyF2: "\x1b[12~", 45 | KeyF3: "\x1b[13~", 46 | KeyF4: "\x1b[14~", 47 | KeyF5: "\x1b[15~", 48 | KeyF6: "\x1b[17~", 49 | KeyF7: "\x1b[18~", 50 | KeyF8: "\x1b[19~", 51 | KeyF9: "\x1b[20~", 52 | KeyF10: "\x1b[21~", 53 | KeyF11: "\x1b[23~", 54 | KeyF12: "\x1b[24~", 55 | KeyF13: "\x1b[25~", 56 | KeyF14: "\x1b[26~", 57 | KeyF15: "\x1b[28~", 58 | KeyF16: "\x1b[29~", 59 | KeyF17: "\x1b[31~", 60 | KeyF18: "\x1b[32~", 61 | KeyF19: "\x1b[33~", 62 | KeyF20: "\x1b[34~", 63 | }) 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_linux.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // linux console 7 | AddTerminfo(&Terminfo{ 8 | Name: "linux", 9 | Colors: 8, 10 | Bell: "\a", 11 | Clear: "\x1b[H\x1b[J", 12 | ShowCursor: "\x1b[?25h\x1b[?0c", 13 | HideCursor: "\x1b[?25l\x1b[?1c", 14 | AttrOff: "\x1b[0;10m", 15 | Underline: "\x1b[4m", 16 | Bold: "\x1b[1m", 17 | Dim: "\x1b[2m", 18 | Blink: "\x1b[5m", 19 | Reverse: "\x1b[7m", 20 | SetFg: "\x1b[3%p1%dm", 21 | SetBg: "\x1b[4%p1%dm", 22 | SetFgBg: "\x1b[3%p1%d;4%p2%dm", 23 | PadChar: "\x00", 24 | AltChars: "+\x0020,\x0021-\x0030.\x190333`\x0004a261f370g361h260i316j331k277l332m300n305o~p304q304r304s_t303u264v301w302x263y363z362{343|330}234~376", 25 | EnterAcs: "\x1b[11m", 26 | ExitAcs: "\x1b[10m", 27 | Mouse: "\x1b[M", 28 | MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", 29 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 30 | CursorBack1: "\b", 31 | CursorUp1: "\x1b[A", 32 | KeyUp: "\x1b[A", 33 | KeyDown: "\x1b[B", 34 | KeyRight: "\x1b[C", 35 | KeyLeft: "\x1b[D", 36 | KeyInsert: "\x1b[2~", 37 | KeyDelete: "\x1b[3~", 38 | KeyBackspace: "177", 39 | KeyHome: "\x1b[1~", 40 | KeyEnd: "\x1b[4~", 41 | KeyPgUp: "\x1b[5~", 42 | KeyPgDn: "\x1b[6~", 43 | KeyF1: "\x1b[[A", 44 | KeyF2: "\x1b[[B", 45 | KeyF3: "\x1b[[C", 46 | KeyF4: "\x1b[[D", 47 | KeyF5: "\x1b[[E", 48 | KeyF6: "\x1b[17~", 49 | KeyF7: "\x1b[18~", 50 | KeyF8: "\x1b[19~", 51 | KeyF9: "\x1b[20~", 52 | KeyF10: "\x1b[21~", 53 | KeyF11: "\x1b[23~", 54 | KeyF12: "\x1b[24~", 55 | KeyF13: "\x1b[25~", 56 | KeyF14: "\x1b[26~", 57 | KeyF15: "\x1b[28~", 58 | KeyF16: "\x1b[29~", 59 | KeyF17: "\x1b[31~", 60 | KeyF18: "\x1b[32~", 61 | KeyF19: "\x1b[33~", 62 | KeyF20: "\x1b[34~", 63 | KeyBacktab: "\x1b[Z", 64 | }) 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_screen_256color.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // GNU Screen with 256 colors 7 | AddTerminfo(&Terminfo{ 8 | Name: "screen-256color", 9 | Columns: 80, 10 | Lines: 24, 11 | Colors: 256, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[J", 14 | EnterCA: "\x1b[?1049h", 15 | ExitCA: "\x1b[?1049l", 16 | ShowCursor: "\x1b[34h\x1b[?25h", 17 | HideCursor: "\x1b[?25l", 18 | AttrOff: "\x1b[m\x0017", 19 | Underline: "\x1b[4m", 20 | Bold: "\x1b[1m", 21 | Blink: "\x1b[5m", 22 | Reverse: "\x1b[7m", 23 | EnterKeypad: "\x1b[?1h\x1b=", 24 | ExitKeypad: "\x1b[?1l\x1b>", 25 | SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", 26 | SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", 27 | 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", 28 | PadChar: "\x00", 29 | AltChars: "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 30 | EnterAcs: "\x0e", 31 | ExitAcs: "\x0f", 32 | EnableAcs: "\x1b(B\x1b)0", 33 | Mouse: "\x1b[M", 34 | MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", 35 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 36 | CursorBack1: "\b", 37 | CursorUp1: "\x1bM", 38 | KeyUp: "\x1bOA", 39 | KeyDown: "\x1bOB", 40 | KeyRight: "\x1bOC", 41 | KeyLeft: "\x1bOD", 42 | KeyInsert: "\x1b[2~", 43 | KeyDelete: "\x1b[3~", 44 | KeyBackspace: "\b", 45 | KeyHome: "\x1b[1~", 46 | KeyEnd: "\x1b[4~", 47 | KeyPgUp: "\x1b[5~", 48 | KeyPgDn: "\x1b[6~", 49 | KeyF1: "\x1bOP", 50 | KeyF2: "\x1bOQ", 51 | KeyF3: "\x1bOR", 52 | KeyF4: "\x1bOS", 53 | KeyF5: "\x1b[15~", 54 | KeyF6: "\x1b[17~", 55 | KeyF7: "\x1b[18~", 56 | KeyF8: "\x1b[19~", 57 | KeyF9: "\x1b[20~", 58 | KeyF10: "\x1b[21~", 59 | KeyF11: "\x1b[23~", 60 | KeyF12: "\x1b[24~", 61 | KeyBacktab: "\x1b[Z", 62 | }) 63 | } 64 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_aixterm.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // IBM Aixterm Terminal Emulator 7 | AddTerminfo(&Terminfo{ 8 | Name: "aixterm", 9 | Columns: 80, 10 | Lines: 25, 11 | Colors: 8, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[J", 14 | AttrOff: "\x1b[0;10m\x1b(B", 15 | Underline: "\x1b[4m", 16 | Bold: "\x1b[1m", 17 | Reverse: "\x1b[7m", 18 | SetFg: "\x1b[3%p1%dm", 19 | SetBg: "\x1b[4%p1%dm", 20 | SetFgBg: "\x1b[3%p1%d;4%p2%dm", 21 | PadChar: "\x00", 22 | AltChars: "jjkkllmmnnqqttuuvvwwxx", 23 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 24 | CursorBack1: "\b", 25 | CursorUp1: "\x1b[A", 26 | KeyUp: "\x1b[A", 27 | KeyDown: "\x1b[B", 28 | KeyRight: "\x1b[C", 29 | KeyLeft: "\x1b[D", 30 | KeyInsert: "\x1b[139q", 31 | KeyDelete: "\x1b[P", 32 | KeyBackspace: "\b", 33 | KeyHome: "\x1b[H", 34 | KeyEnd: "\x1b[146q", 35 | KeyPgUp: "\x1b[150q", 36 | KeyPgDn: "\x1b[154q", 37 | KeyF1: "\x1b[001q", 38 | KeyF2: "\x1b[002q", 39 | KeyF3: "\x1b[003q", 40 | KeyF4: "\x1b[004q", 41 | KeyF5: "\x1b[005q", 42 | KeyF6: "\x1b[006q", 43 | KeyF7: "\x1b[007q", 44 | KeyF8: "\x1b[008q", 45 | KeyF9: "\x1b[009q", 46 | KeyF10: "\x1b[010q", 47 | KeyF11: "\x1b[011q", 48 | KeyF12: "\x1b[012q", 49 | KeyF13: "\x1b[013q", 50 | KeyF14: "\x1b[014q", 51 | KeyF15: "\x1b[015q", 52 | KeyF16: "\x1b[016q", 53 | KeyF17: "\x1b[017q", 54 | KeyF18: "\x1b[018q", 55 | KeyF19: "\x1b[019q", 56 | KeyF20: "\x1b[020q", 57 | KeyF21: "\x1b[021q", 58 | KeyF22: "\x1b[022q", 59 | KeyF23: "\x1b[023q", 60 | KeyF24: "\x1b[024q", 61 | KeyF25: "\x1b[025q", 62 | KeyF26: "\x1b[026q", 63 | KeyF27: "\x1b[027q", 64 | KeyF28: "\x1b[028q", 65 | KeyF29: "\x1b[029q", 66 | KeyF30: "\x1b[030q", 67 | KeyF31: "\x1b[031q", 68 | KeyF32: "\x1b[032q", 69 | KeyF33: "\x1b[033q", 70 | KeyF34: "\x1b[034q", 71 | KeyF35: "\x1b[035q", 72 | KeyF36: "\x1b[036q", 73 | KeyClear: "\x1b[144q", 74 | KeyBacktab: "\x1b[Z", 75 | }) 76 | } 77 | -------------------------------------------------------------------------------- /_examples/gridlayout/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/liamg/gobless" 4 | 5 | func main() { 6 | gui := gobless.NewGUI() 7 | if err := gui.Init(); err != nil { 8 | panic(err) 9 | } 10 | defer gui.Close() 11 | 12 | helloTextbox := gobless.NewTextBox() 13 | helloTextbox.SetText(`Bee and wasp stings can be painful and in some people they can trigger a life-threatening reaction. 14 | 15 | Symptoms include: 16 | 17 | - Wheezing or difficulty breathing 18 | - Severe swelling of the face, throat, or lips 19 | - Nausea, vomiting, or diarrhea 20 | - Stomach cramps 21 | - Itching or hives (in places other than the site of the sting) 22 | - Fast heart rate 23 | - Sudden death`) 24 | helloTextbox.SetBorderColor(gobless.ColorGreen) 25 | helloTextbox.SetTitle("Information") 26 | helloTextbox.SetTextWrap(true) 27 | 28 | quitTextbox := gobless.NewTextBox() 29 | quitTextbox.SetText(`Press Ctrl-q to exit.`) 30 | quitTextbox.SetBorderColor(gobless.ColorDarkRed) 31 | 32 | chart := gobless.NewBarChart() 33 | chart.SetTitle("Diarrhoea") 34 | chart.SetYScale(100) 35 | chart.SetBar("EU", 60) 36 | chart.SetBar("NA", 72) 37 | chart.SetBar("SA", 37) 38 | chart.SetBarStyle(gobless.NewStyle( 39 | gobless.ColorOliveDrab, 40 | gobless.DefaultStyle.ForegroundColor, 41 | )) 42 | 43 | chart2 := gobless.NewBarChart() 44 | chart2.SetTitle("Wasp Count") 45 | chart2.SetYScale(10000000) 46 | chart2.SetBarStyle(gobless.NewStyle(gobless.ColorRed, gobless.ColorWhite)) 47 | chart2.SetBorderColor(gobless.ColorRed) 48 | chart2.SetBar("EU", 3500000) 49 | chart2.SetBar("NA", 1100000) 50 | chart2.SetBar("SA", 9400000) 51 | 52 | rows := []gobless.Component{ 53 | gobless.NewRow( 54 | gobless.GridSizeThreeQuarters, 55 | gobless.NewColumn( 56 | gobless.GridSizeTwoThirds, 57 | helloTextbox, 58 | ), 59 | gobless.NewColumn( 60 | gobless.GridSizeOneThird, 61 | gobless.NewRow( 62 | gobless.GridSizeFull, 63 | gobless.NewColumn( 64 | gobless.GridSizeFull, 65 | chart, 66 | chart2, 67 | ), 68 | ), 69 | ), 70 | ), gobless.NewRow( 71 | gobless.GridSizeOneQuarter, 72 | gobless.NewColumn( 73 | gobless.GridSizeFull, 74 | quitTextbox, 75 | ), 76 | ), 77 | } 78 | 79 | gui.Render(rows...) 80 | 81 | gui.HandleKeyPress(gobless.KeyCtrlQ, func(event gobless.KeyPressEvent) { 82 | gui.Close() 83 | }) 84 | 85 | gui.HandleResize(func(event gobless.ResizeEvent) { 86 | gui.Render(rows...) 87 | }) 88 | 89 | gui.Loop() 90 | } 91 | -------------------------------------------------------------------------------- /keys.go: -------------------------------------------------------------------------------- 1 | package gobless 2 | 3 | import ( 4 | "github.com/gdamore/tcell" 5 | ) 6 | 7 | type Key uint16 8 | 9 | // Abstract from tcell 10 | const ( 11 | KeyF1 = Key(tcell.KeyF1) 12 | KeyF2 = Key(tcell.KeyF2) 13 | KeyF3 = Key(tcell.KeyF3) 14 | KeyF4 = Key(tcell.KeyF4) 15 | KeyF5 = Key(tcell.KeyF5) 16 | KeyF6 = Key(tcell.KeyF6) 17 | KeyF7 = Key(tcell.KeyF7) 18 | KeyF8 = Key(tcell.KeyF8) 19 | KeyF9 = Key(tcell.KeyF9) 20 | KeyF10 = Key(tcell.KeyF10) 21 | KeyF11 = Key(tcell.KeyF11) 22 | KeyF12 = Key(tcell.KeyF12) 23 | KeyInsert = Key(tcell.KeyInsert) 24 | KeyDelete = Key(tcell.KeyDelete) 25 | KeyHome = Key(tcell.KeyHome) 26 | KeyEnd = Key(tcell.KeyEnd) 27 | KeyPgUp = Key(tcell.KeyPgUp) 28 | KeyPgDn = Key(tcell.KeyPgDn) 29 | KeyUp = Key(tcell.KeyUp) 30 | KeyDown = Key(tcell.KeyDown) 31 | KeyLeft = Key(tcell.KeyLeft) 32 | KeyRight = Key(tcell.KeyRight) 33 | ) 34 | 35 | const ( 36 | KeyCtrlSpace = Key(tcell.KeyCtrlSpace) 37 | KeyCtrlA = Key(tcell.KeyCtrlA) 38 | KeyCtrlB = Key(tcell.KeyCtrlB) 39 | KeyCtrlC = Key(tcell.KeyCtrlC) 40 | KeyCtrlD = Key(tcell.KeyCtrlD) 41 | KeyCtrlE = Key(tcell.KeyCtrlE) 42 | KeyCtrlF = Key(tcell.KeyCtrlF) 43 | KeyCtrlG = Key(tcell.KeyCtrlG) 44 | KeyBackspace = Key(tcell.KeyBackspace) 45 | KeyCtrlH = Key(tcell.KeyCtrlH) 46 | KeyTab = Key(tcell.KeyTab) 47 | KeyCtrlI = Key(tcell.KeyCtrlI) 48 | KeyCtrlJ = Key(tcell.KeyCtrlJ) 49 | KeyCtrlK = Key(tcell.KeyCtrlK) 50 | KeyCtrlL = Key(tcell.KeyCtrlL) 51 | KeyEnter = Key(tcell.KeyEnter) 52 | KeyCtrlM = Key(tcell.KeyCtrlM) 53 | KeyCtrlN = Key(tcell.KeyCtrlN) 54 | KeyCtrlO = Key(tcell.KeyCtrlO) 55 | KeyCtrlP = Key(tcell.KeyCtrlP) 56 | KeyCtrlQ = Key(tcell.KeyCtrlQ) 57 | KeyCtrlR = Key(tcell.KeyCtrlR) 58 | KeyCtrlS = Key(tcell.KeyCtrlS) 59 | KeyCtrlT = Key(tcell.KeyCtrlT) 60 | KeyCtrlU = Key(tcell.KeyCtrlU) 61 | KeyCtrlV = Key(tcell.KeyCtrlV) 62 | KeyCtrlW = Key(tcell.KeyCtrlW) 63 | KeyCtrlX = Key(tcell.KeyCtrlX) 64 | KeyCtrlY = Key(tcell.KeyCtrlY) 65 | KeyCtrlZ = Key(tcell.KeyCtrlZ) 66 | KeyEsc = Key(tcell.KeyEsc) 67 | KeyCtrlBackslash = Key(tcell.KeyCtrlBackslash) 68 | KeyCtrlUnderscore = Key(tcell.KeyCtrlUnderscore) 69 | KeyBackspace2 = Key(tcell.KeyBackspace2) 70 | ) 71 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_d200.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // Data General DASHER D200 7 | AddTerminfo(&Terminfo{ 8 | Name: "d200", 9 | Aliases: []string{"d200-dg"}, 10 | Columns: 80, 11 | Lines: 24, 12 | Bell: "\a", 13 | Clear: "\f", 14 | AttrOff: "\x0017\x0025\x0035\x0036E", 15 | Underline: "\x14", 16 | Bold: "\x1eD\x14", 17 | Dim: "\x1c", 18 | Blink: "\x0e", 19 | Reverse: "\x1eD", 20 | PadChar: "\x00", 21 | SetCursor: "\x0020%p2%c%p1%c", 22 | CursorBack1: "\x19", 23 | CursorUp1: "\x17", 24 | KeyUp: "\x17", 25 | KeyDown: "\x1a", 26 | KeyRight: "\x18", 27 | KeyLeft: "\x19", 28 | KeyHome: "\b", 29 | KeyF1: "\x1eq", 30 | KeyF2: "\x1er", 31 | KeyF3: "\x1es", 32 | KeyF4: "\x1et", 33 | KeyF5: "\x1eu", 34 | KeyF6: "\x1ev", 35 | KeyF7: "\x1ew", 36 | KeyF8: "\x1ex", 37 | KeyF9: "\x1ey", 38 | KeyF10: "\x1ez", 39 | KeyF11: "\x1e{", 40 | KeyF12: "\x1e|", 41 | KeyF13: "\x1e}", 42 | KeyF14: "\x1e~", 43 | KeyF15: "\x1ep", 44 | KeyF16: "\x1ea", 45 | KeyF17: "\x1eb", 46 | KeyF18: "\x1ec", 47 | KeyF19: "\x1ed", 48 | KeyF20: "\x1ee", 49 | KeyF21: "\x1ef", 50 | KeyF22: "\x1eg", 51 | KeyF23: "\x1eh", 52 | KeyF24: "\x1ei", 53 | KeyF25: "\x1ej", 54 | KeyF26: "\x1ek", 55 | KeyF27: "\x1el", 56 | KeyF28: "\x1em", 57 | KeyF29: "\x1en", 58 | KeyF30: "\x1e`", 59 | KeyF31: "\x1e1", 60 | KeyF32: "\x1e2", 61 | KeyF33: "\x1e3", 62 | KeyF34: "\x1e4", 63 | KeyF35: "\x1e5", 64 | KeyF36: "\x1e6", 65 | KeyF37: "\x1e7", 66 | KeyF38: "\x1e8", 67 | KeyF39: "\x1e9", 68 | KeyF40: "\x1e:", 69 | KeyF41: "\x1e;", 70 | KeyF42: "\x1e<", 71 | KeyF43: "\x1e=", 72 | KeyF44: "\x1e>", 73 | KeyF45: "\x1e0", 74 | KeyF46: "\x1e!", 75 | KeyF47: "\x1e\"", 76 | KeyF48: "\x1e#", 77 | KeyF49: "\x1e$", 78 | KeyF50: "\x1e%%", 79 | KeyF51: "\x1e&", 80 | KeyF52: "\x1e'", 81 | KeyF53: "\x1e(", 82 | KeyF54: "\x1e)", 83 | KeyF55: "\x1e*", 84 | KeyF56: "\x1e+", 85 | KeyF57: "\x1e,", 86 | KeyF58: "\x1e-", 87 | KeyF59: "\x1e.", 88 | KeyF60: "\x1e ", 89 | KeyClear: "\f", 90 | KeyShfLeft: "\x1e\x19", 91 | KeyShfRight: "\x1e\x18", 92 | KeyShfHome: "\x1e\b", 93 | }) 94 | } 95 | -------------------------------------------------------------------------------- /textbox.go: -------------------------------------------------------------------------------- 1 | package gobless 2 | 3 | import ( 4 | "image" 5 | ) 6 | 7 | type TextBox struct { 8 | width int 9 | height int 10 | x int 11 | y int 12 | text string 13 | wrap bool 14 | style Style 15 | borderColor Color 16 | title string 17 | } 18 | 19 | func NewTextBox() *TextBox { 20 | return &TextBox{ 21 | style: DefaultStyle, 22 | borderColor: ColorDarkCyan, 23 | } 24 | } 25 | 26 | func (textbox *TextBox) SetTitle(title string) { 27 | textbox.title = title 28 | } 29 | func (textbox *TextBox) SetBorderColor(color Color) { 30 | textbox.borderColor = color 31 | } 32 | 33 | func (textbox *TextBox) SetX(x int) { 34 | textbox.x = x 35 | } 36 | func (textbox *TextBox) SetY(y int) { 37 | textbox.y = y 38 | } 39 | func (textbox *TextBox) SetWidth(w int) { 40 | textbox.width = w 41 | } 42 | func (textbox *TextBox) SetHeight(h int) { 43 | textbox.height = h 44 | } 45 | 46 | func (component *TextBox) SetTextWrap(enabled bool) { 47 | component.wrap = enabled 48 | } 49 | func (component *TextBox) SetText(text string) { 50 | component.text = text 51 | } 52 | func (component *TextBox) SetStyle(style Style) { 53 | component.style = style 54 | } 55 | 56 | func (textbox *TextBox) GetTiles(gui *GUI) []Tile { 57 | 58 | cells := map[image.Point]Cell{} 59 | 60 | x, y := 0, 0 61 | 62 | textWidth := textbox.width - 3 // remove border dimensions 63 | textHeight := textbox.height - 2 64 | 65 | for _, r := range []rune(textbox.text) { 66 | if !textbox.wrap && x >= textWidth { 67 | continue 68 | } 69 | switch r { 70 | case '\r': 71 | continue 72 | case '\n': 73 | y++ 74 | x = 0 75 | continue 76 | } 77 | cells[image.Point{X: x, Y: y}] = Cell{ 78 | Rune: r, 79 | Style: textbox.style, 80 | } 81 | x++ 82 | if textbox.wrap && x > textWidth { 83 | x = 0 84 | y++ 85 | } 86 | if y >= textHeight { 87 | break 88 | } 89 | } 90 | 91 | border := NewBorder() 92 | border.SetX(textbox.x) 93 | border.SetY(textbox.y) 94 | border.SetWidth(textbox.width) 95 | border.SetHeight(textbox.height) 96 | border.SetText(textbox.title) 97 | border.SetStyle(NewStyle(textbox.style.BackgroundColor, textbox.borderColor)) 98 | 99 | return append([]Tile{ 100 | Tile{ 101 | Rectangle: image.Rectangle{ 102 | Min: image.Point{X: textbox.x + 1, Y: textbox.y + 1}, 103 | Max: image.Point{X: textbox.x + 1 + textbox.width - 3, Y: textbox.y + 1 + textbox.height - 3}, 104 | }, 105 | Cells: cells, 106 | }, 107 | }, 108 | border.GetTiles(gui)..., 109 | ) 110 | } 111 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_rxvt_unicode.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // rxvt-unicode terminal (X Window System) 7 | AddTerminfo(&Terminfo{ 8 | Name: "rxvt-unicode", 9 | Columns: 80, 10 | Lines: 24, 11 | Colors: 88, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[2J", 14 | EnterCA: "\x1b[?1049h", 15 | ExitCA: "\x1b[r\x1b[?1049l", 16 | ShowCursor: "\x1b[?12l\x1b[?25h", 17 | HideCursor: "\x1b[?25l", 18 | AttrOff: "\x1b[m\x1b(B", 19 | Underline: "\x1b[4m", 20 | Bold: "\x1b[1m", 21 | Blink: "\x1b[5m", 22 | Reverse: "\x1b[7m", 23 | EnterKeypad: "\x1b=", 24 | ExitKeypad: "\x1b>", 25 | SetFg: "\x1b[38;5;%p1%dm", 26 | SetBg: "\x1b[48;5;%p1%dm", 27 | SetFgBg: "\x1b[38;5;%p1%d;48;5;%p2%dm", 28 | AltChars: "+C,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 29 | EnterAcs: "\x1b(0", 30 | ExitAcs: "\x1b(B", 31 | Mouse: "\x1b[M", 32 | MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", 33 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 34 | CursorBack1: "\b", 35 | CursorUp1: "\x1b[A", 36 | KeyUp: "\x1b[A", 37 | KeyDown: "\x1b[B", 38 | KeyRight: "\x1b[C", 39 | KeyLeft: "\x1b[D", 40 | KeyInsert: "\x1b[2~", 41 | KeyDelete: "\x1b[3~", 42 | KeyBackspace: "177", 43 | KeyHome: "\x1b[7~", 44 | KeyEnd: "\x1b[8~", 45 | KeyPgUp: "\x1b[5~", 46 | KeyPgDn: "\x1b[6~", 47 | KeyF1: "\x1b[11~", 48 | KeyF2: "\x1b[12~", 49 | KeyF3: "\x1b[13~", 50 | KeyF4: "\x1b[14~", 51 | KeyF5: "\x1b[15~", 52 | KeyF6: "\x1b[17~", 53 | KeyF7: "\x1b[18~", 54 | KeyF8: "\x1b[19~", 55 | KeyF9: "\x1b[20~", 56 | KeyF10: "\x1b[21~", 57 | KeyF11: "\x1b[23~", 58 | KeyF12: "\x1b[24~", 59 | KeyF13: "\x1b[25~", 60 | KeyF14: "\x1b[26~", 61 | KeyF15: "\x1b[28~", 62 | KeyF16: "\x1b[29~", 63 | KeyF17: "\x1b[31~", 64 | KeyF18: "\x1b[32~", 65 | KeyF19: "\x1b[33~", 66 | KeyF20: "\x1b[34~", 67 | KeyBacktab: "\x1b[Z", 68 | KeyShfLeft: "\x1b[d", 69 | KeyShfRight: "\x1b[c", 70 | KeyShfUp: "\x1b[a", 71 | KeyShfDown: "\x1b[b", 72 | KeyCtrlLeft: "\x1b[Od", 73 | KeyCtrlRight: "\x1b[Oc", 74 | KeyCtrlUp: "\x1b[Oa", 75 | KeyCtrlDown: "\x1b[Ob", 76 | KeyShfHome: "\x1b[7$", 77 | KeyShfEnd: "\x1b[8$", 78 | KeyCtrlHome: "\x1b[7^", 79 | KeyCtrlEnd: "\x1b[8^", 80 | }) 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_rxvt_unicode_256color.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // rxvt-unicode terminal with 256 colors (X Window System) 7 | AddTerminfo(&Terminfo{ 8 | Name: "rxvt-unicode-256color", 9 | Columns: 80, 10 | Lines: 24, 11 | Colors: 256, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[2J", 14 | EnterCA: "\x1b[?1049h", 15 | ExitCA: "\x1b[r\x1b[?1049l", 16 | ShowCursor: "\x1b[?12l\x1b[?25h", 17 | HideCursor: "\x1b[?25l", 18 | AttrOff: "\x1b[m\x1b(B", 19 | Underline: "\x1b[4m", 20 | Bold: "\x1b[1m", 21 | Blink: "\x1b[5m", 22 | Reverse: "\x1b[7m", 23 | EnterKeypad: "\x1b=", 24 | ExitKeypad: "\x1b>", 25 | SetFg: "\x1b[38;5;%p1%dm", 26 | SetBg: "\x1b[48;5;%p1%dm", 27 | SetFgBg: "\x1b[38;5;%p1%d;48;5;%p2%dm", 28 | AltChars: "+C,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 29 | EnterAcs: "\x1b(0", 30 | ExitAcs: "\x1b(B", 31 | Mouse: "\x1b[M", 32 | MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", 33 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 34 | CursorBack1: "\b", 35 | CursorUp1: "\x1b[A", 36 | KeyUp: "\x1b[A", 37 | KeyDown: "\x1b[B", 38 | KeyRight: "\x1b[C", 39 | KeyLeft: "\x1b[D", 40 | KeyInsert: "\x1b[2~", 41 | KeyDelete: "\x1b[3~", 42 | KeyBackspace: "177", 43 | KeyHome: "\x1b[7~", 44 | KeyEnd: "\x1b[8~", 45 | KeyPgUp: "\x1b[5~", 46 | KeyPgDn: "\x1b[6~", 47 | KeyF1: "\x1b[11~", 48 | KeyF2: "\x1b[12~", 49 | KeyF3: "\x1b[13~", 50 | KeyF4: "\x1b[14~", 51 | KeyF5: "\x1b[15~", 52 | KeyF6: "\x1b[17~", 53 | KeyF7: "\x1b[18~", 54 | KeyF8: "\x1b[19~", 55 | KeyF9: "\x1b[20~", 56 | KeyF10: "\x1b[21~", 57 | KeyF11: "\x1b[23~", 58 | KeyF12: "\x1b[24~", 59 | KeyF13: "\x1b[25~", 60 | KeyF14: "\x1b[26~", 61 | KeyF15: "\x1b[28~", 62 | KeyF16: "\x1b[29~", 63 | KeyF17: "\x1b[31~", 64 | KeyF18: "\x1b[32~", 65 | KeyF19: "\x1b[33~", 66 | KeyF20: "\x1b[34~", 67 | KeyBacktab: "\x1b[Z", 68 | KeyShfLeft: "\x1b[d", 69 | KeyShfRight: "\x1b[c", 70 | KeyShfUp: "\x1b[a", 71 | KeyShfDown: "\x1b[b", 72 | KeyCtrlLeft: "\x1b[Od", 73 | KeyCtrlRight: "\x1b[Oc", 74 | KeyCtrlUp: "\x1b[Oa", 75 | KeyCtrlDown: "\x1b[Ob", 76 | KeyShfHome: "\x1b[7$", 77 | KeyShfEnd: "\x1b[8$", 78 | KeyCtrlHome: "\x1b[7^", 79 | KeyCtrlEnd: "\x1b[8^", 80 | }) 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_d210.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // Data General DASHER D210 series 7 | AddTerminfo(&Terminfo{ 8 | Name: "d210", 9 | Aliases: []string{"d214"}, 10 | Columns: 80, 11 | Lines: 24, 12 | Bell: "\a", 13 | Clear: "\x1b[2J", 14 | AttrOff: "\x1b[m", 15 | Underline: "\x1b[4m", 16 | Bold: "\x1b[4;7m", 17 | Dim: "\x1b[2m", 18 | Blink: "\x1b[5m", 19 | Reverse: "\x1b[7m", 20 | PadChar: "\x00", 21 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 22 | CursorBack1: "\b", 23 | CursorUp1: "\x1b[A", 24 | KeyUp: "\x1b[A", 25 | KeyDown: "\x1b[B", 26 | KeyRight: "\x1b[C", 27 | KeyLeft: "\x1b[D", 28 | KeyHome: "\x1b[H", 29 | KeyF1: "\x1b[001z", 30 | KeyF2: "\x1b[002z", 31 | KeyF3: "\x1b[003z", 32 | KeyF4: "\x1b[004z", 33 | KeyF5: "\x1b[005z", 34 | KeyF6: "\x1b[006z", 35 | KeyF7: "\x1b[007z", 36 | KeyF8: "\x1b[008z", 37 | KeyF9: "\x1b[009z", 38 | KeyF10: "\x1b[010z", 39 | KeyF11: "\x1b[011z", 40 | KeyF12: "\x1b[012z", 41 | KeyF13: "\x1b[013z", 42 | KeyF14: "\x1b[014z", 43 | KeyF15: "\x1b[000z", 44 | KeyF16: "\x1b[101z", 45 | KeyF17: "\x1b[102z", 46 | KeyF18: "\x1b[103z", 47 | KeyF19: "\x1b[104z", 48 | KeyF20: "\x1b[105z", 49 | KeyF21: "\x1b[106z", 50 | KeyF22: "\x1b[107z", 51 | KeyF23: "\x1b[108z", 52 | KeyF24: "\x1b[109z", 53 | KeyF25: "\x1b[110z", 54 | KeyF26: "\x1b[111z", 55 | KeyF27: "\x1b[112z", 56 | KeyF28: "\x1b[113z", 57 | KeyF29: "\x1b[114z", 58 | KeyF30: "\x1b[100z", 59 | KeyF31: "\x1b[201z", 60 | KeyF32: "\x1b[202z", 61 | KeyF33: "\x1b[203z", 62 | KeyF34: "\x1b[204z", 63 | KeyF35: "\x1b[205z", 64 | KeyF36: "\x1b[206z", 65 | KeyF37: "\x1b[207z", 66 | KeyF38: "\x1b[208z", 67 | KeyF39: "\x1b[209z", 68 | KeyF40: "\x1b[210z", 69 | KeyF41: "\x1b[211z", 70 | KeyF42: "\x1b[212z", 71 | KeyF43: "\x1b[213z", 72 | KeyF44: "\x1b[214z", 73 | KeyF45: "\x1b[200z", 74 | KeyF46: "\x1b[301z", 75 | KeyF47: "\x1b[302z", 76 | KeyF48: "\x1b[303z", 77 | KeyF49: "\x1b[304z", 78 | KeyF50: "\x1b[305z", 79 | KeyF51: "\x1b[306z", 80 | KeyF52: "\x1b[307z", 81 | KeyF53: "\x1b[308z", 82 | KeyF54: "\x1b[309z", 83 | KeyF55: "\x1b[310z", 84 | KeyF56: "\x1b[311z", 85 | KeyF57: "\x1b[312z", 86 | KeyF58: "\x1b[313z", 87 | KeyF59: "\x1b[314z", 88 | KeyF60: "\x1b[300z", 89 | KeyPrint: "\x1b[i", 90 | KeyClear: "\x1b[2J", 91 | }) 92 | } 93 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/errors.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The TCell Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use file except in compliance with the License. 5 | // You may obtain a copy of the license at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package tcell 16 | 17 | import ( 18 | "errors" 19 | "time" 20 | 21 | "github.com/gdamore/tcell/terminfo" 22 | ) 23 | 24 | var ( 25 | // ErrTermNotFound indicates that a suitable terminal entry could 26 | // not be found. This can result from either not having TERM set, 27 | // or from the TERM failing to support certain minimal functionality, 28 | // in particular absolute cursor addressability (the cup capability) 29 | // is required. For example, legacy "adm3" lacks this capability, 30 | // whereas the slightly newer "adm3a" supports it. This failure 31 | // occurs most often with "dumb". 32 | ErrTermNotFound = terminfo.ErrTermNotFound 33 | 34 | // ErrNoScreen indicates that no suitable screen could be found. 35 | // This may result from attempting to run on a platform where there 36 | // is no support for either termios or console I/O (such as nacl), 37 | // or from running in an environment where there is no access to 38 | // a suitable console/terminal device. (For example, running on 39 | // without a controlling TTY or with no /dev/tty on POSIX platforms.) 40 | ErrNoScreen = errors.New("no suitable screen available") 41 | 42 | // ErrNoCharset indicates that the locale environment the 43 | // program is not supported by the program, because no suitable 44 | // encoding was found for it. This problem never occurs if 45 | // the environment is UTF-8 or UTF-16. 46 | ErrNoCharset = errors.New("character set not supported") 47 | 48 | // ErrEventQFull indicates that the event queue is full, and 49 | // cannot accept more events. 50 | ErrEventQFull = errors.New("event queue full") 51 | ) 52 | 53 | // An EventError is an event representing some sort of error, and carries 54 | // an error payload. 55 | type EventError struct { 56 | t time.Time 57 | err error 58 | } 59 | 60 | // When returns the time when the event was created. 61 | func (ev *EventError) When() time.Time { 62 | return ev.t 63 | } 64 | 65 | // Error implements the error. 66 | func (ev *EventError) Error() string { 67 | return ev.err.Error() 68 | } 69 | 70 | // NewEventError creates an ErrorEvent with the given error payload. 71 | func NewEventError(err error) *EventError { 72 | return &EventError{t: time.Now(), err: err} 73 | } 74 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/unicode/cldr/base.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cldr 6 | 7 | import ( 8 | "encoding/xml" 9 | "regexp" 10 | "strconv" 11 | ) 12 | 13 | // Elem is implemented by every XML element. 14 | type Elem interface { 15 | setEnclosing(Elem) 16 | setName(string) 17 | enclosing() Elem 18 | 19 | GetCommon() *Common 20 | } 21 | 22 | type hidden struct { 23 | CharData string `xml:",chardata"` 24 | Alias *struct { 25 | Common 26 | Source string `xml:"source,attr"` 27 | Path string `xml:"path,attr"` 28 | } `xml:"alias"` 29 | Def *struct { 30 | Common 31 | Choice string `xml:"choice,attr,omitempty"` 32 | Type string `xml:"type,attr,omitempty"` 33 | } `xml:"default"` 34 | } 35 | 36 | // Common holds several of the most common attributes and sub elements 37 | // of an XML element. 38 | type Common struct { 39 | XMLName xml.Name 40 | name string 41 | enclElem Elem 42 | Type string `xml:"type,attr,omitempty"` 43 | Reference string `xml:"reference,attr,omitempty"` 44 | Alt string `xml:"alt,attr,omitempty"` 45 | ValidSubLocales string `xml:"validSubLocales,attr,omitempty"` 46 | Draft string `xml:"draft,attr,omitempty"` 47 | hidden 48 | } 49 | 50 | // Default returns the default type to select from the enclosed list 51 | // or "" if no default value is specified. 52 | func (e *Common) Default() string { 53 | if e.Def == nil { 54 | return "" 55 | } 56 | if e.Def.Choice != "" { 57 | return e.Def.Choice 58 | } else if e.Def.Type != "" { 59 | // Type is still used by the default element in collation. 60 | return e.Def.Type 61 | } 62 | return "" 63 | } 64 | 65 | // Element returns the XML element name. 66 | func (e *Common) Element() string { 67 | return e.name 68 | } 69 | 70 | // GetCommon returns e. It is provided such that Common implements Elem. 71 | func (e *Common) GetCommon() *Common { 72 | return e 73 | } 74 | 75 | // Data returns the character data accumulated for this element. 76 | func (e *Common) Data() string { 77 | e.CharData = charRe.ReplaceAllStringFunc(e.CharData, replaceUnicode) 78 | return e.CharData 79 | } 80 | 81 | func (e *Common) setName(s string) { 82 | e.name = s 83 | } 84 | 85 | func (e *Common) enclosing() Elem { 86 | return e.enclElem 87 | } 88 | 89 | func (e *Common) setEnclosing(en Elem) { 90 | e.enclElem = en 91 | } 92 | 93 | // Escape characters that can be escaped without further escaping the string. 94 | var charRe = regexp.MustCompile(`&#x[0-9a-fA-F]*;|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|\\x[0-9a-fA-F]{2}|\\[0-7]{3}|\\[abtnvfr]`) 95 | 96 | // replaceUnicode converts hexadecimal Unicode codepoint notations to a one-rune string. 97 | // It assumes the input string is correctly formatted. 98 | func replaceUnicode(s string) string { 99 | if s[1] == '#' { 100 | r, _ := strconv.ParseInt(s[3:len(s)-1], 16, 32) 101 | return string(r) 102 | } 103 | r, _, _, _ := strconv.UnquoteChar(s, 0) 104 | return string(r) 105 | } 106 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_aterm.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // AfterStep terminal 7 | AddTerminfo(&Terminfo{ 8 | Name: "aterm", 9 | Columns: 80, 10 | Lines: 24, 11 | Colors: 8, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[2J", 14 | EnterCA: "\x1b7\x1b[?47h", 15 | ExitCA: "\x1b[2J\x1b[?47l\x1b8", 16 | ShowCursor: "\x1b[?25h", 17 | HideCursor: "\x1b[?25l", 18 | AttrOff: "\x1b[m\x0017", 19 | Underline: "\x1b[4m", 20 | Bold: "\x1b[1m", 21 | Blink: "\x1b[5m", 22 | Reverse: "\x1b[7m", 23 | EnterKeypad: "\x1b=", 24 | ExitKeypad: "\x1b>", 25 | SetFg: "\x1b[3%p1%dm", 26 | SetBg: "\x1b[4%p1%dm", 27 | SetFgBg: "\x1b[3%p1%d;4%p2%dm", 28 | PadChar: "\x00", 29 | AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 30 | EnterAcs: "\x0e", 31 | ExitAcs: "\x0f", 32 | EnableAcs: "\x1b(B\x1b)0", 33 | Mouse: "\x1b[M", 34 | MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", 35 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 36 | CursorBack1: "\b", 37 | CursorUp1: "\x1b[A", 38 | KeyUp: "\x1b[A", 39 | KeyDown: "\x1b[B", 40 | KeyRight: "\x1b[C", 41 | KeyLeft: "\x1b[D", 42 | KeyInsert: "\x1b[2~", 43 | KeyDelete: "\x1b[3~", 44 | KeyBackspace: "177", 45 | KeyHome: "\x1b[7~", 46 | KeyEnd: "\x1b[8~", 47 | KeyPgUp: "\x1b[5~", 48 | KeyPgDn: "\x1b[6~", 49 | KeyF1: "\x1bOP", 50 | KeyF2: "\x1bOQ", 51 | KeyF3: "\x1bOR", 52 | KeyF4: "\x1bOS", 53 | KeyF5: "\x1b[15~", 54 | KeyF6: "\x1b[17~", 55 | KeyF7: "\x1b[18~", 56 | KeyF8: "\x1b[19~", 57 | KeyF9: "\x1b[20~", 58 | KeyF10: "\x1b[21~", 59 | KeyF11: "\x1b[23~", 60 | KeyF12: "\x1b[24~", 61 | KeyF13: "\x1b[25~", 62 | KeyF14: "\x1b[26~", 63 | KeyF15: "\x1b[28~", 64 | KeyF16: "\x1b[29~", 65 | KeyF17: "\x1b[31~", 66 | KeyF18: "\x1b[32~", 67 | KeyF19: "\x1b[33~", 68 | KeyF20: "\x1b[34~", 69 | KeyF21: "\x1b[23$", 70 | KeyF22: "\x1b[24$", 71 | KeyF23: "\x1b[11^", 72 | KeyF24: "\x1b[12^", 73 | KeyF25: "\x1b[13^", 74 | KeyF26: "\x1b[14^", 75 | KeyF27: "\x1b[15^", 76 | KeyF28: "\x1b[17^", 77 | KeyF29: "\x1b[18^", 78 | KeyF30: "\x1b[19^", 79 | KeyF31: "\x1b[20^", 80 | KeyF32: "\x1b[21^", 81 | KeyF33: "\x1b[23^", 82 | KeyF34: "\x1b[24^", 83 | KeyF35: "\x1b[25^", 84 | KeyF36: "\x1b[26^", 85 | KeyF37: "\x1b[28^", 86 | KeyF38: "\x1b[29^", 87 | KeyF39: "\x1b[31^", 88 | KeyF40: "\x1b[32^", 89 | KeyF41: "\x1b[33^", 90 | KeyF42: "\x1b[34^", 91 | KeyF43: "\x1b[23@", 92 | KeyF44: "\x1b[24@", 93 | KeyBacktab: "\x1b[Z", 94 | KeyShfLeft: "\x1b[d", 95 | KeyShfRight: "\x1b[c", 96 | KeyShfUp: "\x1b[a", 97 | KeyShfDown: "\x1b[b", 98 | KeyCtrlLeft: "\x1b[Od", 99 | KeyCtrlRight: "\x1b[Oc", 100 | KeyCtrlUp: "\x1b[Oa", 101 | KeyCtrlDown: "\x1b[Ob", 102 | KeyShfHome: "\x1b[7$", 103 | KeyShfEnd: "\x1b[8$", 104 | KeyCtrlHome: "\x1b[7^", 105 | KeyCtrlEnd: "\x1b[8^", 106 | }) 107 | } 108 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_rxvt.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // rxvt terminal emulator (X Window System) 7 | AddTerminfo(&Terminfo{ 8 | Name: "rxvt", 9 | Columns: 80, 10 | Lines: 24, 11 | Colors: 8, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[2J", 14 | EnterCA: "\x1b7\x1b[?47h", 15 | ExitCA: "\x1b[2J\x1b[?47l\x1b8", 16 | ShowCursor: "\x1b[?25h", 17 | HideCursor: "\x1b[?25l", 18 | AttrOff: "\x1b[m\x0017", 19 | Underline: "\x1b[4m", 20 | Bold: "\x1b[1m", 21 | Blink: "\x1b[5m", 22 | Reverse: "\x1b[7m", 23 | EnterKeypad: "\x1b=", 24 | ExitKeypad: "\x1b>", 25 | SetFg: "\x1b[3%p1%dm", 26 | SetBg: "\x1b[4%p1%dm", 27 | SetFgBg: "\x1b[3%p1%d;4%p2%dm", 28 | PadChar: "\x00", 29 | AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 30 | EnterAcs: "\x0e", 31 | ExitAcs: "\x0f", 32 | EnableAcs: "\x1b(B\x1b)0", 33 | Mouse: "\x1b[M", 34 | MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", 35 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 36 | CursorBack1: "\b", 37 | CursorUp1: "\x1b[A", 38 | KeyUp: "\x1b[A", 39 | KeyDown: "\x1b[B", 40 | KeyRight: "\x1b[C", 41 | KeyLeft: "\x1b[D", 42 | KeyInsert: "\x1b[2~", 43 | KeyDelete: "\x1b[3~", 44 | KeyBackspace: "\b", 45 | KeyHome: "\x1b[7~", 46 | KeyEnd: "\x1b[8~", 47 | KeyPgUp: "\x1b[5~", 48 | KeyPgDn: "\x1b[6~", 49 | KeyF1: "\x1b[11~", 50 | KeyF2: "\x1b[12~", 51 | KeyF3: "\x1b[13~", 52 | KeyF4: "\x1b[14~", 53 | KeyF5: "\x1b[15~", 54 | KeyF6: "\x1b[17~", 55 | KeyF7: "\x1b[18~", 56 | KeyF8: "\x1b[19~", 57 | KeyF9: "\x1b[20~", 58 | KeyF10: "\x1b[21~", 59 | KeyF11: "\x1b[23~", 60 | KeyF12: "\x1b[24~", 61 | KeyF13: "\x1b[25~", 62 | KeyF14: "\x1b[26~", 63 | KeyF15: "\x1b[28~", 64 | KeyF16: "\x1b[29~", 65 | KeyF17: "\x1b[31~", 66 | KeyF18: "\x1b[32~", 67 | KeyF19: "\x1b[33~", 68 | KeyF20: "\x1b[34~", 69 | KeyF21: "\x1b[23$", 70 | KeyF22: "\x1b[24$", 71 | KeyF23: "\x1b[11^", 72 | KeyF24: "\x1b[12^", 73 | KeyF25: "\x1b[13^", 74 | KeyF26: "\x1b[14^", 75 | KeyF27: "\x1b[15^", 76 | KeyF28: "\x1b[17^", 77 | KeyF29: "\x1b[18^", 78 | KeyF30: "\x1b[19^", 79 | KeyF31: "\x1b[20^", 80 | KeyF32: "\x1b[21^", 81 | KeyF33: "\x1b[23^", 82 | KeyF34: "\x1b[24^", 83 | KeyF35: "\x1b[25^", 84 | KeyF36: "\x1b[26^", 85 | KeyF37: "\x1b[28^", 86 | KeyF38: "\x1b[29^", 87 | KeyF39: "\x1b[31^", 88 | KeyF40: "\x1b[32^", 89 | KeyF41: "\x1b[33^", 90 | KeyF42: "\x1b[34^", 91 | KeyF43: "\x1b[23@", 92 | KeyF44: "\x1b[24@", 93 | KeyBacktab: "\x1b[Z", 94 | KeyShfLeft: "\x1b[d", 95 | KeyShfRight: "\x1b[c", 96 | KeyShfUp: "\x1b[a", 97 | KeyShfDown: "\x1b[b", 98 | KeyCtrlLeft: "\x1b[Od", 99 | KeyCtrlRight: "\x1b[Oc", 100 | KeyCtrlUp: "\x1b[Oa", 101 | KeyCtrlDown: "\x1b[Ob", 102 | KeyShfHome: "\x1b[7$", 103 | KeyShfEnd: "\x1b[8$", 104 | KeyCtrlHome: "\x1b[7^", 105 | KeyCtrlEnd: "\x1b[8^", 106 | }) 107 | } 108 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/tscreen_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd netbsd openbsd dragonfly 2 | 3 | // Copyright 2017 The TCell Authors 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use file except in compliance with the License. 7 | // You may obtain a copy of the license at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | package tcell 18 | 19 | import ( 20 | "os" 21 | "os/signal" 22 | "syscall" 23 | "unsafe" 24 | ) 25 | 26 | type termiosPrivate syscall.Termios 27 | 28 | func (t *tScreen) termioInit() error { 29 | var e error 30 | var newtios termiosPrivate 31 | var fd uintptr 32 | var tios uintptr 33 | var ioc uintptr 34 | t.tiosp = &termiosPrivate{} 35 | 36 | if t.in, e = os.OpenFile("/dev/tty", os.O_RDONLY, 0); e != nil { 37 | goto failed 38 | } 39 | if t.out, e = os.OpenFile("/dev/tty", os.O_WRONLY, 0); e != nil { 40 | goto failed 41 | } 42 | 43 | tios = uintptr(unsafe.Pointer(t.tiosp)) 44 | ioc = uintptr(syscall.TIOCGETA) 45 | fd = uintptr(t.out.Fd()) 46 | if _, _, e1 := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioc, tios, 0, 0, 0); e1 != 0 { 47 | e = e1 48 | goto failed 49 | } 50 | 51 | // On this platform (FreeBSD and family), the baud rate is stored 52 | // directly as an integer in termios.c_ospeed. No bitmasking required. 53 | t.baud = int(t.tiosp.Ospeed) 54 | newtios = *t.tiosp 55 | newtios.Iflag &^= syscall.IGNBRK | syscall.BRKINT | syscall.PARMRK | 56 | syscall.ISTRIP | syscall.INLCR | syscall.IGNCR | 57 | syscall.ICRNL | syscall.IXON 58 | newtios.Oflag &^= syscall.OPOST 59 | newtios.Lflag &^= syscall.ECHO | syscall.ECHONL | syscall.ICANON | 60 | syscall.ISIG | syscall.IEXTEN 61 | newtios.Cflag &^= syscall.CSIZE | syscall.PARENB 62 | newtios.Cflag |= syscall.CS8 63 | 64 | tios = uintptr(unsafe.Pointer(&newtios)) 65 | 66 | ioc = uintptr(syscall.TIOCSETA) 67 | if _, _, e1 := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioc, tios, 0, 0, 0); e1 != 0 { 68 | e = e1 69 | goto failed 70 | } 71 | 72 | signal.Notify(t.sigwinch, syscall.SIGWINCH) 73 | 74 | if w, h, e := t.getWinSize(); e == nil && w != 0 && h != 0 { 75 | t.cells.Resize(w, h) 76 | } 77 | 78 | return nil 79 | 80 | failed: 81 | if t.in != nil { 82 | t.in.Close() 83 | } 84 | if t.out != nil { 85 | t.out.Close() 86 | } 87 | return e 88 | } 89 | 90 | func (t *tScreen) termioFini() { 91 | 92 | signal.Stop(t.sigwinch) 93 | 94 | <-t.indoneq 95 | 96 | if t.out != nil { 97 | fd := uintptr(t.out.Fd()) 98 | ioc := uintptr(syscall.TIOCSETAF) 99 | tios := uintptr(unsafe.Pointer(t.tiosp)) 100 | syscall.Syscall6(syscall.SYS_IOCTL, fd, ioc, tios, 0, 0, 0) 101 | t.out.Close() 102 | } 103 | if t.in != nil { 104 | t.in.Close() 105 | } 106 | } 107 | 108 | func (t *tScreen) getWinSize() (int, int, error) { 109 | 110 | fd := uintptr(t.out.Fd()) 111 | dim := [4]uint16{} 112 | dimp := uintptr(unsafe.Pointer(&dim)) 113 | ioc := uintptr(syscall.TIOCGWINSZ) 114 | if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, 115 | fd, ioc, dimp, 0, 0, 0); err != 0 { 116 | return -1, -1, err 117 | } 118 | return int(dim[1]), int(dim[0]), nil 119 | } 120 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_Eterm_256color.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // Eterm with xterm 256-colors 7 | AddTerminfo(&Terminfo{ 8 | Name: "Eterm-256color", 9 | Columns: 80, 10 | Lines: 24, 11 | Colors: 256, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[2J", 14 | EnterCA: "\x1b7\x1b[?47h", 15 | ExitCA: "\x1b[2J\x1b[?47l\x1b8", 16 | ShowCursor: "\x1b[?25h", 17 | HideCursor: "\x1b[?25l", 18 | AttrOff: "\x1b[m\x0017", 19 | Underline: "\x1b[4m", 20 | Bold: "\x1b[1m", 21 | Blink: "\x1b[5m", 22 | Reverse: "\x1b[7m", 23 | SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", 24 | SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", 25 | 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", 26 | PadChar: "\x00", 27 | AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 28 | EnterAcs: "\x0e", 29 | ExitAcs: "\x0f", 30 | EnableAcs: "\x1b)0", 31 | Mouse: "\x1b[M", 32 | MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", 33 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 34 | CursorBack1: "\b", 35 | CursorUp1: "\x1b[A", 36 | KeyUp: "\x1b[A", 37 | KeyDown: "\x1b[B", 38 | KeyRight: "\x1b[C", 39 | KeyLeft: "\x1b[D", 40 | KeyInsert: "\x1b[2~", 41 | KeyDelete: "\x1b[3~", 42 | KeyBackspace: "\b", 43 | KeyHome: "\x1b[7~", 44 | KeyEnd: "\x1b[8~", 45 | KeyPgUp: "\x1b[5~", 46 | KeyPgDn: "\x1b[6~", 47 | KeyF1: "\x1b[11~", 48 | KeyF2: "\x1b[12~", 49 | KeyF3: "\x1b[13~", 50 | KeyF4: "\x1b[14~", 51 | KeyF5: "\x1b[15~", 52 | KeyF6: "\x1b[17~", 53 | KeyF7: "\x1b[18~", 54 | KeyF8: "\x1b[19~", 55 | KeyF9: "\x1b[20~", 56 | KeyF10: "\x1b[21~", 57 | KeyF11: "\x1b[23~", 58 | KeyF12: "\x1b[24~", 59 | KeyF13: "\x1b[25~", 60 | KeyF14: "\x1b[26~", 61 | KeyF15: "\x1b[28~", 62 | KeyF16: "\x1b[29~", 63 | KeyF17: "\x1b[31~", 64 | KeyF18: "\x1b[32~", 65 | KeyF19: "\x1b[33~", 66 | KeyF20: "\x1b[34~", 67 | KeyF21: "\x1b[23$", 68 | KeyF22: "\x1b[24$", 69 | KeyF23: "\x1b[11^", 70 | KeyF24: "\x1b[12^", 71 | KeyF25: "\x1b[13^", 72 | KeyF26: "\x1b[14^", 73 | KeyF27: "\x1b[15^", 74 | KeyF28: "\x1b[17^", 75 | KeyF29: "\x1b[18^", 76 | KeyF30: "\x1b[19^", 77 | KeyF31: "\x1b[20^", 78 | KeyF32: "\x1b[21^", 79 | KeyF33: "\x1b[23^", 80 | KeyF34: "\x1b[24^", 81 | KeyF35: "\x1b[25^", 82 | KeyF36: "\x1b[26^", 83 | KeyF37: "\x1b[28^", 84 | KeyF38: "\x1b[29^", 85 | KeyF39: "\x1b[31^", 86 | KeyF40: "\x1b[32^", 87 | KeyF41: "\x1b[33^", 88 | KeyF42: "\x1b[34^", 89 | KeyF43: "\x1b[23@", 90 | KeyF44: "\x1b[24@", 91 | KeyHelp: "\x1b[28~", 92 | KeyShfLeft: "\x1b[d", 93 | KeyShfRight: "\x1b[c", 94 | KeyShfUp: "\x1b[a", 95 | KeyShfDown: "\x1b[b", 96 | KeyCtrlLeft: "\x1b[Od", 97 | KeyCtrlRight: "\x1b[Oc", 98 | KeyCtrlUp: "\x1b[Oa", 99 | KeyCtrlDown: "\x1b[Ob", 100 | KeyShfHome: "\x1b[7$", 101 | KeyShfEnd: "\x1b[8$", 102 | KeyCtrlHome: "\x1b[7^", 103 | KeyCtrlEnd: "\x1b[8^", 104 | }) 105 | } 106 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/encoding/internal/identifier/identifier.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:generate go run gen.go 6 | 7 | // Package identifier defines the contract between implementations of Encoding 8 | // and Index by defining identifiers that uniquely identify standardized coded 9 | // character sets (CCS) and character encoding schemes (CES), which we will 10 | // together refer to as encodings, for which Encoding implementations provide 11 | // converters to and from UTF-8. This package is typically only of concern to 12 | // implementers of Indexes and Encodings. 13 | // 14 | // One part of the identifier is the MIB code, which is defined by IANA and 15 | // uniquely identifies a CCS or CES. Each code is associated with data that 16 | // references authorities, official documentation as well as aliases and MIME 17 | // names. 18 | // 19 | // Not all CESs are covered by the IANA registry. The "other" string that is 20 | // returned by ID can be used to identify other character sets or versions of 21 | // existing ones. 22 | // 23 | // It is recommended that each package that provides a set of Encodings provide 24 | // the All and Common variables to reference all supported encodings and 25 | // commonly used subset. This allows Index implementations to include all 26 | // available encodings without explicitly referencing or knowing about them. 27 | package identifier 28 | 29 | // Note: this package is internal, but could be made public if there is a need 30 | // for writing third-party Indexes and Encodings. 31 | 32 | // References: 33 | // - http://source.icu-project.org/repos/icu/icu/trunk/source/data/mappings/convrtrs.txt 34 | // - http://www.iana.org/assignments/character-sets/character-sets.xhtml 35 | // - http://www.iana.org/assignments/ianacharset-mib/ianacharset-mib 36 | // - http://www.ietf.org/rfc/rfc2978.txt 37 | // - http://www.unicode.org/reports/tr22/ 38 | // - http://www.w3.org/TR/encoding/ 39 | // - https://encoding.spec.whatwg.org/ 40 | // - https://encoding.spec.whatwg.org/encodings.json 41 | // - https://tools.ietf.org/html/rfc6657#section-5 42 | 43 | // Interface can be implemented by Encodings to define the CCS or CES for which 44 | // it implements conversions. 45 | type Interface interface { 46 | // ID returns an encoding identifier. Exactly one of the mib and other 47 | // values should be non-zero. 48 | // 49 | // In the usual case it is only necessary to indicate the MIB code. The 50 | // other string can be used to specify encodings for which there is no MIB, 51 | // such as "x-mac-dingbat". 52 | // 53 | // The other string may only contain the characters a-z, A-Z, 0-9, - and _. 54 | ID() (mib MIB, other string) 55 | 56 | // NOTE: the restrictions on the encoding are to allow extending the syntax 57 | // with additional information such as versions, vendors and other variants. 58 | } 59 | 60 | // A MIB identifies an encoding. It is derived from the IANA MIB codes and adds 61 | // some identifiers for some encodings that are not covered by the IANA 62 | // standard. 63 | // 64 | // See http://www.iana.org/assignments/ianacharset-mib. 65 | type MIB uint16 66 | 67 | // These additional MIB types are not defined in IANA. They are added because 68 | // they are common and defined within the text repo. 69 | const ( 70 | // Unofficial marks the start of encodings not registered by IANA. 71 | Unofficial MIB = 10000 + iota 72 | 73 | // Replacement is the WhatWG replacement encoding. 74 | Replacement 75 | 76 | // XUserDefined is the code for x-user-defined. 77 | XUserDefined 78 | 79 | // MacintoshCyrillic is the code for x-mac-cyrillic. 80 | MacintoshCyrillic 81 | ) 82 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_rxvt_256color.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // rxvt 2.7.9 with xterm 256-colors 7 | AddTerminfo(&Terminfo{ 8 | Name: "rxvt-256color", 9 | Columns: 80, 10 | Lines: 24, 11 | Colors: 256, 12 | Bell: "\a", 13 | Clear: "\x1b[H\x1b[2J", 14 | EnterCA: "\x1b7\x1b[?47h", 15 | ExitCA: "\x1b[2J\x1b[?47l\x1b8", 16 | ShowCursor: "\x1b[?25h", 17 | HideCursor: "\x1b[?25l", 18 | AttrOff: "\x1b[m\x0017", 19 | Underline: "\x1b[4m", 20 | Bold: "\x1b[1m", 21 | Blink: "\x1b[5m", 22 | Reverse: "\x1b[7m", 23 | EnterKeypad: "\x1b=", 24 | ExitKeypad: "\x1b>", 25 | SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", 26 | SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", 27 | 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", 28 | PadChar: "\x00", 29 | AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 30 | EnterAcs: "\x0e", 31 | ExitAcs: "\x0f", 32 | EnableAcs: "\x1b(B\x1b)0", 33 | Mouse: "\x1b[M", 34 | MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", 35 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 36 | CursorBack1: "\b", 37 | CursorUp1: "\x1b[A", 38 | KeyUp: "\x1b[A", 39 | KeyDown: "\x1b[B", 40 | KeyRight: "\x1b[C", 41 | KeyLeft: "\x1b[D", 42 | KeyInsert: "\x1b[2~", 43 | KeyDelete: "\x1b[3~", 44 | KeyBackspace: "\b", 45 | KeyHome: "\x1b[7~", 46 | KeyEnd: "\x1b[8~", 47 | KeyPgUp: "\x1b[5~", 48 | KeyPgDn: "\x1b[6~", 49 | KeyF1: "\x1b[11~", 50 | KeyF2: "\x1b[12~", 51 | KeyF3: "\x1b[13~", 52 | KeyF4: "\x1b[14~", 53 | KeyF5: "\x1b[15~", 54 | KeyF6: "\x1b[17~", 55 | KeyF7: "\x1b[18~", 56 | KeyF8: "\x1b[19~", 57 | KeyF9: "\x1b[20~", 58 | KeyF10: "\x1b[21~", 59 | KeyF11: "\x1b[23~", 60 | KeyF12: "\x1b[24~", 61 | KeyF13: "\x1b[25~", 62 | KeyF14: "\x1b[26~", 63 | KeyF15: "\x1b[28~", 64 | KeyF16: "\x1b[29~", 65 | KeyF17: "\x1b[31~", 66 | KeyF18: "\x1b[32~", 67 | KeyF19: "\x1b[33~", 68 | KeyF20: "\x1b[34~", 69 | KeyF21: "\x1b[23$", 70 | KeyF22: "\x1b[24$", 71 | KeyF23: "\x1b[11^", 72 | KeyF24: "\x1b[12^", 73 | KeyF25: "\x1b[13^", 74 | KeyF26: "\x1b[14^", 75 | KeyF27: "\x1b[15^", 76 | KeyF28: "\x1b[17^", 77 | KeyF29: "\x1b[18^", 78 | KeyF30: "\x1b[19^", 79 | KeyF31: "\x1b[20^", 80 | KeyF32: "\x1b[21^", 81 | KeyF33: "\x1b[23^", 82 | KeyF34: "\x1b[24^", 83 | KeyF35: "\x1b[25^", 84 | KeyF36: "\x1b[26^", 85 | KeyF37: "\x1b[28^", 86 | KeyF38: "\x1b[29^", 87 | KeyF39: "\x1b[31^", 88 | KeyF40: "\x1b[32^", 89 | KeyF41: "\x1b[33^", 90 | KeyF42: "\x1b[34^", 91 | KeyF43: "\x1b[23@", 92 | KeyF44: "\x1b[24@", 93 | KeyBacktab: "\x1b[Z", 94 | KeyShfLeft: "\x1b[d", 95 | KeyShfRight: "\x1b[c", 96 | KeyShfUp: "\x1b[a", 97 | KeyShfDown: "\x1b[b", 98 | KeyCtrlLeft: "\x1b[Od", 99 | KeyCtrlRight: "\x1b[Oc", 100 | KeyCtrlUp: "\x1b[Oa", 101 | KeyCtrlDown: "\x1b[Ob", 102 | KeyShfHome: "\x1b[7$", 103 | KeyShfEnd: "\x1b[8$", 104 | KeyCtrlHome: "\x1b[7^", 105 | KeyCtrlEnd: "\x1b[8^", 106 | }) 107 | } 108 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_konsole.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // KDE console window 7 | AddTerminfo(&Terminfo{ 8 | Name: "konsole", 9 | Columns: 80, 10 | Lines: 24, 11 | Colors: 8, 12 | Clear: "\x1b[H\x1b[2J", 13 | EnterCA: "\x1b7\x1b[?47h", 14 | ExitCA: "\x1b[2J\x1b[?47l\x1b8", 15 | ShowCursor: "\x1b[?25h", 16 | HideCursor: "\x1b[?25l", 17 | AttrOff: "\x1b[0m\x0017", 18 | Underline: "\x1b[4m", 19 | Bold: "\x1b[1m", 20 | Blink: "\x1b[5m", 21 | Reverse: "\x1b[7m", 22 | EnterKeypad: "\x1b[?1h\x1b=", 23 | ExitKeypad: "\x1b[?1l\x1b>", 24 | SetFg: "\x1b[3%p1%dm", 25 | SetBg: "\x1b[4%p1%dm", 26 | SetFgBg: "\x1b[3%p1%d;4%p2%dm", 27 | AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 28 | EnterAcs: "\x0e", 29 | ExitAcs: "\x0f", 30 | EnableAcs: "\x1b)0", 31 | Mouse: "\x1b[M", 32 | MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", 33 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 34 | CursorBack1: "\b", 35 | CursorUp1: "\x1b[A", 36 | KeyUp: "\x1bOA", 37 | KeyDown: "\x1bOB", 38 | KeyRight: "\x1bOC", 39 | KeyLeft: "\x1bOD", 40 | KeyInsert: "\x1b[2~", 41 | KeyDelete: "\x1b[3~", 42 | KeyBackspace: "177", 43 | KeyHome: "\x1bOH", 44 | KeyEnd: "\x1bOF", 45 | KeyPgUp: "\x1b[5~", 46 | KeyPgDn: "\x1b[6~", 47 | KeyF1: "\x1bOP", 48 | KeyF2: "\x1bOQ", 49 | KeyF3: "\x1bOR", 50 | KeyF4: "\x1bOS", 51 | KeyF5: "\x1b[15~", 52 | KeyF6: "\x1b[17~", 53 | KeyF7: "\x1b[18~", 54 | KeyF8: "\x1b[19~", 55 | KeyF9: "\x1b[20~", 56 | KeyF10: "\x1b[21~", 57 | KeyF11: "\x1b[23~", 58 | KeyF12: "\x1b[24~", 59 | KeyF13: "\x1bO2P", 60 | KeyF14: "\x1bO2Q", 61 | KeyF15: "\x1bO2R", 62 | KeyF16: "\x1bO2S", 63 | KeyF17: "\x1b[15;2~", 64 | KeyF18: "\x1b[17;2~", 65 | KeyF19: "\x1b[18;2~", 66 | KeyF20: "\x1b[19;2~", 67 | KeyF21: "\x1b[20;2~", 68 | KeyF22: "\x1b[21;2~", 69 | KeyF23: "\x1b[23;2~", 70 | KeyF24: "\x1b[24;2~", 71 | KeyF25: "\x1bO5P", 72 | KeyF26: "\x1bO5Q", 73 | KeyF27: "\x1bO5R", 74 | KeyF28: "\x1bO5S", 75 | KeyF29: "\x1b[15;5~", 76 | KeyF30: "\x1b[17;5~", 77 | KeyF31: "\x1b[18;5~", 78 | KeyF32: "\x1b[19;5~", 79 | KeyF33: "\x1b[20;5~", 80 | KeyF34: "\x1b[21;5~", 81 | KeyF35: "\x1b[23;5~", 82 | KeyF36: "\x1b[24;5~", 83 | KeyF37: "\x1bO6P", 84 | KeyF38: "\x1bO6Q", 85 | KeyF39: "\x1bO6R", 86 | KeyF40: "\x1bO6S", 87 | KeyF41: "\x1b[15;6~", 88 | KeyF42: "\x1b[17;6~", 89 | KeyF43: "\x1b[18;6~", 90 | KeyF44: "\x1b[19;6~", 91 | KeyF45: "\x1b[20;6~", 92 | KeyF46: "\x1b[21;6~", 93 | KeyF47: "\x1b[23;6~", 94 | KeyF48: "\x1b[24;6~", 95 | KeyF49: "\x1bO3P", 96 | KeyF50: "\x1bO3Q", 97 | KeyF51: "\x1bO3R", 98 | KeyF52: "\x1bO3S", 99 | KeyF53: "\x1b[15;3~", 100 | KeyF54: "\x1b[17;3~", 101 | KeyF55: "\x1b[18;3~", 102 | KeyF56: "\x1b[19;3~", 103 | KeyF57: "\x1b[20;3~", 104 | KeyF58: "\x1b[21;3~", 105 | KeyF59: "\x1b[23;3~", 106 | KeyF60: "\x1b[24;3~", 107 | KeyF61: "\x1bO4P", 108 | KeyF62: "\x1bO4Q", 109 | KeyF63: "\x1bO4R", 110 | KeyBacktab: "\x1b[Z", 111 | }) 112 | } 113 | -------------------------------------------------------------------------------- /border.go: -------------------------------------------------------------------------------- 1 | package gobless 2 | 3 | import ( 4 | "image" 5 | ) 6 | 7 | type Border struct { 8 | width int 9 | height int 10 | x int 11 | y int 12 | text string 13 | style Style 14 | textStyle Style 15 | } 16 | 17 | func NewBorder() *Border { 18 | style := DefaultStyle 19 | style.ForegroundColor = ColorDarkCyan 20 | textStyle := DefaultStyle 21 | textStyle.ForegroundColor = ColorWhite 22 | return &Border{ 23 | style: style, 24 | textStyle: textStyle, 25 | } 26 | } 27 | 28 | func (component *Border) SetX(x int) { 29 | component.x = x 30 | } 31 | func (component *Border) SetY(y int) { 32 | component.y = y 33 | } 34 | func (component *Border) SetWidth(w int) { 35 | component.width = w 36 | } 37 | func (component *Border) SetHeight(h int) { 38 | component.height = h 39 | } 40 | func (component *Border) SetText(text string) { 41 | component.text = text 42 | } 43 | func (component *Border) SetStyle(style Style) { 44 | component.style = style 45 | } 46 | 47 | func (component *Border) GetTiles(gui *GUI) []Tile { 48 | 49 | topLeft := '┌' 50 | topRight := '┐' 51 | bottomLeft := '└' 52 | vertical := '│' 53 | horizontal := '─' 54 | bottomRight := '┘' 55 | 56 | topTile := Tile{ 57 | Rectangle: image.Rectangle{ 58 | Min: image.Point{ 59 | X: component.x, 60 | Y: component.y, 61 | }, 62 | Max: image.Point{ 63 | X: component.x + component.width - 1, 64 | Y: component.y, 65 | }, 66 | }, 67 | Cells: map[image.Point]Cell{}, 68 | } 69 | bottomTile := Tile{ 70 | Rectangle: image.Rectangle{ 71 | Min: image.Point{ 72 | X: component.x, 73 | Y: component.y + component.height - 1, 74 | }, 75 | Max: image.Point{ 76 | X: component.x + component.width - 1, 77 | Y: component.y + component.height - 1, 78 | }, 79 | }, 80 | Cells: map[image.Point]Cell{}, 81 | } 82 | leftTile := Tile{ 83 | Rectangle: image.Rectangle{ 84 | Min: image.Point{ 85 | X: component.x, 86 | Y: component.y, 87 | }, 88 | Max: image.Point{ 89 | X: component.x, 90 | Y: component.y + component.height - 1, 91 | }, 92 | }, 93 | Cells: map[image.Point]Cell{}, 94 | } 95 | rightTile := Tile{ 96 | Rectangle: image.Rectangle{ 97 | Min: image.Point{ 98 | X: component.x + component.width - 1, 99 | Y: component.y, 100 | }, 101 | Max: image.Point{ 102 | X: component.x + component.width - 1, 103 | Y: component.y + component.height - 1, 104 | }, 105 | }, 106 | Cells: map[image.Point]Cell{}, 107 | } 108 | 109 | textOffsetFromCorner := 2 110 | 111 | for x := 0; x < component.width; x++ { 112 | 113 | style := component.style 114 | 115 | borderRune := horizontal 116 | 117 | if x == 0 { 118 | borderRune = bottomLeft 119 | } else if x == component.width-1 { 120 | borderRune = bottomRight 121 | } 122 | 123 | bottomTile.Cells[image.Point{X: x, Y: 0}] = Cell{ 124 | Rune: borderRune, 125 | Style: style, 126 | } 127 | 128 | if x == 0 { 129 | borderRune = topLeft 130 | } else if x == component.width-1 { 131 | borderRune = topRight 132 | } else if x >= textOffsetFromCorner && x-textOffsetFromCorner < len(component.text) { 133 | borderRune = []rune(component.text)[x-textOffsetFromCorner] 134 | style = component.textStyle 135 | } 136 | 137 | topTile.Cells[image.Point{X: x, Y: 0}] = Cell{ 138 | Rune: borderRune, 139 | Style: style, 140 | } 141 | } 142 | 143 | for y := 1; y < component.height-1; y++ { 144 | leftTile.Cells[image.Point{X: 0, Y: y}] = Cell{ 145 | Rune: vertical, 146 | Style: component.style, 147 | } 148 | rightTile.Cells[image.Point{X: 0, Y: y}] = Cell{ 149 | Rune: vertical, 150 | Style: component.style, 151 | } 152 | } 153 | 154 | return []Tile{topTile, bottomTile, leftTile, rightTile} 155 | } 156 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/runes.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The TCell Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use file except in compliance with the License. 5 | // You may obtain a copy of the license at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package tcell 16 | 17 | // The names of these constants are chosen to match Terminfo names, 18 | // modulo case, and changing the prefix from ACS_ to Rune. These are 19 | // the runes we provide extra special handling for, with ASCII fallbacks 20 | // for terminals that lack them. 21 | const ( 22 | RuneSterling = '£' 23 | RuneDArrow = '↓' 24 | RuneLArrow = '←' 25 | RuneRArrow = '→' 26 | RuneUArrow = '↑' 27 | RuneBullet = '·' 28 | RuneBoard = '░' 29 | RuneCkBoard = '▒' 30 | RuneDegree = '°' 31 | RuneDiamond = '◆' 32 | RuneGEqual = '≥' 33 | RunePi = 'π' 34 | RuneHLine = '─' 35 | RuneLantern = '§' 36 | RunePlus = '┼' 37 | RuneLEqual = '≤' 38 | RuneLLCorner = '└' 39 | RuneLRCorner = '┘' 40 | RuneNEqual = '≠' 41 | RunePlMinus = '±' 42 | RuneS1 = '⎺' 43 | RuneS3 = '⎻' 44 | RuneS7 = '⎼' 45 | RuneS9 = '⎽' 46 | RuneBlock = '█' 47 | RuneTTee = '┬' 48 | RuneRTee = '┤' 49 | RuneLTee = '├' 50 | RuneBTee = '┴' 51 | RuneULCorner = '┌' 52 | RuneURCorner = '┐' 53 | RuneVLine = '│' 54 | ) 55 | 56 | // RuneFallbacks is the default map of fallback strings that will be 57 | // used to replace a rune when no other more appropriate transformation 58 | // is available, and the rune cannot be displayed directly. 59 | // 60 | // New entries may be added to this map over time, as it becomes clear 61 | // that such is desirable. Characters that represent either letters or 62 | // numbers should not be added to this list unless it is certain that 63 | // the meaning will still convey unambiguously. 64 | // 65 | // As an example, it would be appropriate to add an ASCII mapping for 66 | // the full width form of the letter 'A', but it would not be appropriate 67 | // to do so a glyph representing the country China. 68 | // 69 | // Programs that desire richer fallbacks may register additional ones, 70 | // or change or even remove these mappings with Screen.RegisterRuneFallback 71 | // Screen.UnregisterRuneFallback methods. 72 | // 73 | // Note that Unicode is presumed to be able to display all glyphs. 74 | // This is a pretty poor assumption, but there is no easy way to 75 | // figure out which glyphs are supported in a given font. Hence, 76 | // some care in selecting the characters you support in your application 77 | // is still appropriate. 78 | var RuneFallbacks = map[rune]string{ 79 | RuneSterling: "f", 80 | RuneDArrow: "v", 81 | RuneLArrow: "<", 82 | RuneRArrow: ">", 83 | RuneUArrow: "^", 84 | RuneBullet: "o", 85 | RuneBoard: "#", 86 | RuneCkBoard: ":", 87 | RuneDegree: "\\", 88 | RuneDiamond: "+", 89 | RuneGEqual: ">", 90 | RunePi: "*", 91 | RuneHLine: "-", 92 | RuneLantern: "#", 93 | RunePlus: "+", 94 | RuneLEqual: "<", 95 | RuneLLCorner: "+", 96 | RuneLRCorner: "+", 97 | RuneNEqual: "!", 98 | RunePlMinus: "#", 99 | RuneS1: "~", 100 | RuneS3: "-", 101 | RuneS7: "-", 102 | RuneS9: "_", 103 | RuneBlock: "#", 104 | RuneTTee: "+", 105 | RuneRTee: "+", 106 | RuneLTee: "+", 107 | RuneBTee: "+", 108 | RuneULCorner: "+", 109 | RuneURCorner: "+", 110 | RuneVLine: "|", 111 | } 112 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/tscreen_linux.go: -------------------------------------------------------------------------------- 1 | // +build linux 2 | 3 | // Copyright 2017 The TCell Authors 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use file except in compliance with the License. 7 | // You may obtain a copy of the license at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | package tcell 18 | 19 | import ( 20 | "os" 21 | "os/signal" 22 | "syscall" 23 | "unsafe" 24 | ) 25 | 26 | type termiosPrivate syscall.Termios 27 | 28 | func (t *tScreen) termioInit() error { 29 | var e error 30 | var newtios termiosPrivate 31 | var fd uintptr 32 | var tios uintptr 33 | var ioc uintptr 34 | t.tiosp = &termiosPrivate{} 35 | 36 | if t.in, e = os.OpenFile("/dev/tty", os.O_RDONLY, 0); e != nil { 37 | goto failed 38 | } 39 | if t.out, e = os.OpenFile("/dev/tty", os.O_WRONLY, 0); e != nil { 40 | goto failed 41 | } 42 | 43 | tios = uintptr(unsafe.Pointer(t.tiosp)) 44 | ioc = uintptr(syscall.TCGETS) 45 | fd = uintptr(t.out.Fd()) 46 | if _, _, e1 := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioc, tios, 0, 0, 0); e1 != 0 { 47 | e = e1 48 | goto failed 49 | } 50 | 51 | // On this platform, the baud rate is stored 52 | // directly as an integer in termios.c_ospeed. 53 | t.baud = int(t.tiosp.Ospeed) 54 | newtios = *t.tiosp 55 | newtios.Iflag &^= syscall.IGNBRK | syscall.BRKINT | syscall.PARMRK | 56 | syscall.ISTRIP | syscall.INLCR | syscall.IGNCR | 57 | syscall.ICRNL | syscall.IXON 58 | newtios.Oflag &^= syscall.OPOST 59 | newtios.Lflag &^= syscall.ECHO | syscall.ECHONL | syscall.ICANON | 60 | syscall.ISIG | syscall.IEXTEN 61 | newtios.Cflag &^= syscall.CSIZE | syscall.PARENB 62 | newtios.Cflag |= syscall.CS8 63 | 64 | // This is setup for blocking reads. In the past we attempted to 65 | // use non-blocking reads, but now a separate input loop and timer 66 | // copes with the problems we had on some systems (BSD/Darwin) 67 | // where close hung forever. 68 | newtios.Cc[syscall.VMIN] = 1 69 | newtios.Cc[syscall.VTIME] = 0 70 | 71 | tios = uintptr(unsafe.Pointer(&newtios)) 72 | 73 | // Well this kind of sucks, because we don't have TCSETSF, but only 74 | // TCSETS. This can leave some output unflushed. 75 | ioc = uintptr(syscall.TCSETS) 76 | if _, _, e1 := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioc, tios, 0, 0, 0); e1 != 0 { 77 | e = e1 78 | goto failed 79 | } 80 | 81 | signal.Notify(t.sigwinch, syscall.SIGWINCH) 82 | 83 | if w, h, e := t.getWinSize(); e == nil && w != 0 && h != 0 { 84 | t.cells.Resize(w, h) 85 | } 86 | 87 | return nil 88 | 89 | failed: 90 | if t.in != nil { 91 | t.in.Close() 92 | } 93 | if t.out != nil { 94 | t.out.Close() 95 | } 96 | return e 97 | } 98 | 99 | func (t *tScreen) termioFini() { 100 | 101 | signal.Stop(t.sigwinch) 102 | 103 | <-t.indoneq 104 | 105 | if t.out != nil { 106 | fd := uintptr(t.out.Fd()) 107 | // XXX: We'd really rather do TCSETSF here! 108 | ioc := uintptr(syscall.TCSETS) 109 | tios := uintptr(unsafe.Pointer(t.tiosp)) 110 | syscall.Syscall6(syscall.SYS_IOCTL, fd, ioc, tios, 0, 0, 0) 111 | t.out.Close() 112 | } 113 | if t.in != nil { 114 | t.in.Close() 115 | } 116 | } 117 | 118 | func (t *tScreen) getWinSize() (int, int, error) { 119 | 120 | fd := uintptr(t.out.Fd()) 121 | dim := [4]uint16{} 122 | dimp := uintptr(unsafe.Pointer(&dim)) 123 | ioc := uintptr(syscall.TIOCGWINSZ) 124 | if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, 125 | fd, ioc, dimp, 0, 0, 0); err != 0 { 126 | return -1, -1, err 127 | } 128 | return int(dim[1]), int(dim[0]), nil 129 | } 130 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/term_konsole_256color.go: -------------------------------------------------------------------------------- 1 | // Generated automatically. DO NOT HAND-EDIT. 2 | 3 | package terminfo 4 | 5 | func init() { 6 | // KDE console window with xterm 256-colors 7 | AddTerminfo(&Terminfo{ 8 | Name: "konsole-256color", 9 | Columns: 80, 10 | Lines: 24, 11 | Colors: 256, 12 | Clear: "\x1b[H\x1b[2J", 13 | EnterCA: "\x1b7\x1b[?47h", 14 | ExitCA: "\x1b[2J\x1b[?47l\x1b8", 15 | ShowCursor: "\x1b[?25h", 16 | HideCursor: "\x1b[?25l", 17 | AttrOff: "\x1b[0m\x0017", 18 | Underline: "\x1b[4m", 19 | Bold: "\x1b[1m", 20 | Blink: "\x1b[5m", 21 | Reverse: "\x1b[7m", 22 | EnterKeypad: "\x1b[?1h\x1b=", 23 | ExitKeypad: "\x1b[?1l\x1b>", 24 | SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", 25 | SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", 26 | 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", 27 | AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", 28 | EnterAcs: "\x0e", 29 | ExitAcs: "\x0f", 30 | EnableAcs: "\x1b)0", 31 | Mouse: "\x1b[M", 32 | MouseMode: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c", 33 | SetCursor: "\x1b[%i%p1%d;%p2%dH", 34 | CursorBack1: "\b", 35 | CursorUp1: "\x1b[A", 36 | KeyUp: "\x1bOA", 37 | KeyDown: "\x1bOB", 38 | KeyRight: "\x1bOC", 39 | KeyLeft: "\x1bOD", 40 | KeyInsert: "\x1b[2~", 41 | KeyDelete: "\x1b[3~", 42 | KeyBackspace: "177", 43 | KeyHome: "\x1bOH", 44 | KeyEnd: "\x1bOF", 45 | KeyPgUp: "\x1b[5~", 46 | KeyPgDn: "\x1b[6~", 47 | KeyF1: "\x1bOP", 48 | KeyF2: "\x1bOQ", 49 | KeyF3: "\x1bOR", 50 | KeyF4: "\x1bOS", 51 | KeyF5: "\x1b[15~", 52 | KeyF6: "\x1b[17~", 53 | KeyF7: "\x1b[18~", 54 | KeyF8: "\x1b[19~", 55 | KeyF9: "\x1b[20~", 56 | KeyF10: "\x1b[21~", 57 | KeyF11: "\x1b[23~", 58 | KeyF12: "\x1b[24~", 59 | KeyF13: "\x1bO2P", 60 | KeyF14: "\x1bO2Q", 61 | KeyF15: "\x1bO2R", 62 | KeyF16: "\x1bO2S", 63 | KeyF17: "\x1b[15;2~", 64 | KeyF18: "\x1b[17;2~", 65 | KeyF19: "\x1b[18;2~", 66 | KeyF20: "\x1b[19;2~", 67 | KeyF21: "\x1b[20;2~", 68 | KeyF22: "\x1b[21;2~", 69 | KeyF23: "\x1b[23;2~", 70 | KeyF24: "\x1b[24;2~", 71 | KeyF25: "\x1bO5P", 72 | KeyF26: "\x1bO5Q", 73 | KeyF27: "\x1bO5R", 74 | KeyF28: "\x1bO5S", 75 | KeyF29: "\x1b[15;5~", 76 | KeyF30: "\x1b[17;5~", 77 | KeyF31: "\x1b[18;5~", 78 | KeyF32: "\x1b[19;5~", 79 | KeyF33: "\x1b[20;5~", 80 | KeyF34: "\x1b[21;5~", 81 | KeyF35: "\x1b[23;5~", 82 | KeyF36: "\x1b[24;5~", 83 | KeyF37: "\x1bO6P", 84 | KeyF38: "\x1bO6Q", 85 | KeyF39: "\x1bO6R", 86 | KeyF40: "\x1bO6S", 87 | KeyF41: "\x1b[15;6~", 88 | KeyF42: "\x1b[17;6~", 89 | KeyF43: "\x1b[18;6~", 90 | KeyF44: "\x1b[19;6~", 91 | KeyF45: "\x1b[20;6~", 92 | KeyF46: "\x1b[21;6~", 93 | KeyF47: "\x1b[23;6~", 94 | KeyF48: "\x1b[24;6~", 95 | KeyF49: "\x1bO3P", 96 | KeyF50: "\x1bO3Q", 97 | KeyF51: "\x1bO3R", 98 | KeyF52: "\x1bO3S", 99 | KeyF53: "\x1b[15;3~", 100 | KeyF54: "\x1b[17;3~", 101 | KeyF55: "\x1b[18;3~", 102 | KeyF56: "\x1b[19;3~", 103 | KeyF57: "\x1b[20;3~", 104 | KeyF58: "\x1b[21;3~", 105 | KeyF59: "\x1b[23;3~", 106 | KeyF60: "\x1b[24;3~", 107 | KeyF61: "\x1bO4P", 108 | KeyF62: "\x1bO4Q", 109 | KeyF63: "\x1bO4R", 110 | KeyBacktab: "\x1b[Z", 111 | }) 112 | } 113 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/mouse.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The TCell Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use file except in compliance with the License. 5 | // You may obtain a copy of the license at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package tcell 16 | 17 | import ( 18 | "time" 19 | ) 20 | 21 | // EventMouse is a mouse event. It is sent on either mouse up or mouse down 22 | // events. It is also sent on mouse motion events - if the terminal supports 23 | // it. We make every effort to ensure that mouse release events are delivered. 24 | // Hence, click drag can be identified by a motion event with the mouse down, 25 | // without any intervening button release. On some terminals only the initiating 26 | // press and terminating release event will be delivered. 27 | // 28 | // Mouse wheel events, when reported, may appear on their own as individual 29 | // impulses; that is, there will normally not be a release event delivered 30 | // for mouse wheel movements. 31 | // 32 | // Most terminals cannot report the state of more than one button at a time -- 33 | // and some cannot report motion events unless a button is pressed. 34 | // 35 | // Applications can inspect the time between events to resolve double or 36 | // triple clicks. 37 | type EventMouse struct { 38 | t time.Time 39 | btn ButtonMask 40 | mod ModMask 41 | x int 42 | y int 43 | } 44 | 45 | // When returns the time when this EventMouse was created. 46 | func (ev *EventMouse) When() time.Time { 47 | return ev.t 48 | } 49 | 50 | // Buttons returns the list of buttons that were pressed or wheel motions. 51 | func (ev *EventMouse) Buttons() ButtonMask { 52 | return ev.btn 53 | } 54 | 55 | // Modifiers returns a list of keyboard modifiers that were pressed 56 | // with the mouse button(s). 57 | func (ev *EventMouse) Modifiers() ModMask { 58 | return ev.mod 59 | } 60 | 61 | // Position returns the mouse position in character cells. The origin 62 | // 0, 0 is at the upper left corner. 63 | func (ev *EventMouse) Position() (int, int) { 64 | return ev.x, ev.y 65 | } 66 | 67 | // NewEventMouse is used to create a new mouse event. Applications 68 | // shouldn't need to use this; its mostly for screen implementors. 69 | func NewEventMouse(x, y int, btn ButtonMask, mod ModMask) *EventMouse { 70 | return &EventMouse{t: time.Now(), x: x, y: y, btn: btn, mod: mod} 71 | } 72 | 73 | // ButtonMask is a mask of mouse buttons and wheel events. Mouse button presses 74 | // are normally delivered as both press and release events. Mouse wheel events 75 | // are normally just single impulse events. Windows supports up to eight 76 | // separate buttons plus all four wheel directions, but XTerm can only support 77 | // mouse buttons 1-3 and wheel up/down. Its not unheard of for terminals 78 | // to support only one or two buttons (think Macs). Old terminals, and true 79 | // emulations (such as vt100) won't support mice at all, of course. 80 | type ButtonMask int16 81 | 82 | // These are the actual button values. 83 | const ( 84 | Button1 ButtonMask = 1 << iota // Usually left mouse button. 85 | Button2 // Usually the middle mouse button. 86 | Button3 // Usually the right mouse button. 87 | Button4 // Often a side button (thumb/next). 88 | Button5 // Often a side button (thumb/prev). 89 | Button6 90 | Button7 91 | Button8 92 | WheelUp // Wheel motion up/away from user. 93 | WheelDown // Wheel motion down/towards user. 94 | WheelLeft // Wheel motion to left. 95 | WheelRight // Wheel motion to right. 96 | ButtonNone ButtonMask = 0 // No button or wheel events. 97 | ) 98 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/encoding/internal/identifier/gen.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | package main 8 | 9 | import ( 10 | "bytes" 11 | "encoding/xml" 12 | "fmt" 13 | "io" 14 | "log" 15 | "strings" 16 | 17 | "golang.org/x/text/internal/gen" 18 | ) 19 | 20 | type registry struct { 21 | XMLName xml.Name `xml:"registry"` 22 | Updated string `xml:"updated"` 23 | Registry []struct { 24 | ID string `xml:"id,attr"` 25 | Record []struct { 26 | Name string `xml:"name"` 27 | Xref []struct { 28 | Type string `xml:"type,attr"` 29 | Data string `xml:"data,attr"` 30 | } `xml:"xref"` 31 | Desc struct { 32 | Data string `xml:",innerxml"` 33 | // Any []struct { 34 | // Data string `xml:",chardata"` 35 | // } `xml:",any"` 36 | // Data string `xml:",chardata"` 37 | } `xml:"description,"` 38 | MIB string `xml:"value"` 39 | Alias []string `xml:"alias"` 40 | MIME string `xml:"preferred_alias"` 41 | } `xml:"record"` 42 | } `xml:"registry"` 43 | } 44 | 45 | func main() { 46 | r := gen.OpenIANAFile("assignments/character-sets/character-sets.xml") 47 | reg := ®istry{} 48 | if err := xml.NewDecoder(r).Decode(®); err != nil && err != io.EOF { 49 | log.Fatalf("Error decoding charset registry: %v", err) 50 | } 51 | if len(reg.Registry) == 0 || reg.Registry[0].ID != "character-sets-1" { 52 | log.Fatalf("Unexpected ID %s", reg.Registry[0].ID) 53 | } 54 | 55 | w := &bytes.Buffer{} 56 | fmt.Fprintf(w, "const (\n") 57 | for _, rec := range reg.Registry[0].Record { 58 | constName := "" 59 | for _, a := range rec.Alias { 60 | if strings.HasPrefix(a, "cs") && strings.IndexByte(a, '-') == -1 { 61 | // Some of the constant definitions have comments in them. Strip those. 62 | constName = strings.Title(strings.SplitN(a[2:], "\n", 2)[0]) 63 | } 64 | } 65 | if constName == "" { 66 | switch rec.MIB { 67 | case "2085": 68 | constName = "HZGB2312" // Not listed as alias for some reason. 69 | default: 70 | log.Fatalf("No cs alias defined for %s.", rec.MIB) 71 | } 72 | } 73 | if rec.MIME != "" { 74 | rec.MIME = fmt.Sprintf(" (MIME: %s)", rec.MIME) 75 | } 76 | fmt.Fprintf(w, "// %s is the MIB identifier with IANA name %s%s.\n//\n", constName, rec.Name, rec.MIME) 77 | if len(rec.Desc.Data) > 0 { 78 | fmt.Fprint(w, "// ") 79 | d := xml.NewDecoder(strings.NewReader(rec.Desc.Data)) 80 | inElem := true 81 | attr := "" 82 | for { 83 | t, err := d.Token() 84 | if err != nil { 85 | if err != io.EOF { 86 | log.Fatal(err) 87 | } 88 | break 89 | } 90 | switch x := t.(type) { 91 | case xml.CharData: 92 | attr = "" // Don't need attribute info. 93 | a := bytes.Split([]byte(x), []byte("\n")) 94 | for i, b := range a { 95 | if b = bytes.TrimSpace(b); len(b) != 0 { 96 | if !inElem && i > 0 { 97 | fmt.Fprint(w, "\n// ") 98 | } 99 | inElem = false 100 | fmt.Fprintf(w, "%s ", string(b)) 101 | } 102 | } 103 | case xml.StartElement: 104 | if x.Name.Local == "xref" { 105 | inElem = true 106 | use := false 107 | for _, a := range x.Attr { 108 | if a.Name.Local == "type" { 109 | use = use || a.Value != "person" 110 | } 111 | if a.Name.Local == "data" && use { 112 | attr = a.Value + " " 113 | } 114 | } 115 | } 116 | case xml.EndElement: 117 | inElem = false 118 | fmt.Fprint(w, attr) 119 | } 120 | } 121 | fmt.Fprint(w, "\n") 122 | } 123 | for _, x := range rec.Xref { 124 | switch x.Type { 125 | case "rfc": 126 | fmt.Fprintf(w, "// Reference: %s\n", strings.ToUpper(x.Data)) 127 | case "uri": 128 | fmt.Fprintf(w, "// Reference: %s\n", x.Data) 129 | } 130 | } 131 | fmt.Fprintf(w, "%s MIB = %s\n", constName, rec.MIB) 132 | fmt.Fprintln(w) 133 | } 134 | fmt.Fprintln(w, ")") 135 | 136 | gen.WriteGoFile("mib.go", "identifier", w.Bytes()) 137 | } 138 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gobless 2 | Build beautiful terminal dashboards and GUIs in Golang. 3 | 4 | ![example](./_examples/gridlayout/example.png) 5 | 6 | The name was intended to be pronounced _go-bless_ due to the inspiration from [blessed-contrib](https://github.com/yaronn/blessed-contrib), but _gob-less_ is kind of funnier, so we'll go with that instead. 7 | 8 | Thanks to [tcell](https://github.com/gdamore/tcell), full cross-platform terminal support is expected. 9 | 10 | ## Requirements 11 | 12 | - Go 1.10+ 13 | - Terminal with: 14 | - Unicode support 15 | - 256 color support 16 | 17 | ## Get Started 18 | 19 | ```bash 20 | go get github.com/liamg/gobless 21 | ``` 22 | 23 | You can get started by experimenting with the various [examples](_examples/). 24 | 25 | ## Components 26 | 27 | ### Text Box 28 | 29 | ![example](./_examples/textbox/example.png) 30 | 31 | ```golang 32 | textbox := gobless.NewTextBox() 33 | textbox.SetWidth(64) 34 | textbox.SetHeight(10) 35 | helloTextbox.SetTextWrap(true) 36 | helloTextbox.SetText(`Lorem ipsum...`) 37 | ``` 38 | 39 | Full example code is [here](_examples/textbox). 40 | 41 | ### Bar Chart 42 | 43 | ![example](./_examples/barchart/example.gif) 44 | 45 | ```golang 46 | chart := gobless.NewBarChart() 47 | chart.SetTitle("Traffic") 48 | chart.SetWidth(40) 49 | chart.SetHeight(15) 50 | chart.SetYScale(100) 51 | chart.SetBar("Europe", 60) 52 | chart.SetBar("US", 72) 53 | chart.SetBar("Asia", 37) 54 | ``` 55 | 56 | Full example code is [here](_examples/barchart). 57 | 58 | ### Progress Bar 59 | 60 | ### Sparklines 61 | 62 | ### Line Chart 63 | 64 | ### Block Chart 65 | 66 | (kind of like blessed-contrib's stacked gauge) 67 | 68 | ### Donut 69 | 70 | ### Log 71 | 72 | ### Table 73 | 74 | ### Tree 75 | 76 | ### Dot Matrix 77 | 78 | The dot matrix component allows you set blocks of colour at double the resolution of the terminal characters, using the various partial quadrant unicode characters. 79 | 80 | It includes utility methods for drawing lines, circles etc. 81 | 82 | ![example](./_examples/dotmatrix/example.png) 83 | 84 | Example code is [here](_examples/dotmatrix). 85 | 86 | ## Layout System 87 | 88 | Gobless includes a built-in CSS style 12 column nestable grid layout system. This uses `Rows` and `Columns` (which are themselves components) to quickly build a UI with minimal effort. 89 | 90 | ![example](./_examples/gridlayout/example.png) 91 | 92 | ```golang 93 | rows := []gobless.Component{ 94 | gobless.NewRow( 95 | gobless.GridSizeHalf, 96 | gobless.NewColumn( 97 | gobless.GridSizeTwoThirds, 98 | helloTextbox, 99 | ), 100 | gobless.NewColumn( 101 | gobless.GridSizeOneThird, 102 | gobless.NewRow( 103 | gobless.GridSizeFull, 104 | gobless.NewColumn( 105 | gobless.GridSizeFull, 106 | chart, 107 | chart2, 108 | ), 109 | ), 110 | ), 111 | ), 112 | gobless.NewRow( 113 | gobless.GridSizeHalf, 114 | gobless.NewColumn( 115 | gobless.GridSizeFull, 116 | quitTextbox, 117 | ), 118 | ), 119 | } 120 | 121 | gui.Render(rows...) 122 | ``` 123 | 124 | You can also detect [resize events](#events) and automatically resize the layout of your components if you wish. 125 | 126 | ```golang 127 | gui.HandleResize(func(event gobless.ResizeEvent) { 128 | gui.Render(rows...) 129 | }) 130 | ``` 131 | 132 | A [full example](_examples/gridlayout) is also available. 133 | 134 | Alternatively, if you need to, you can position components absolutely using the `.SetX()`, `.SetY()`, `.SetWidth()` and `.SetHeight()` methods, omitting the presence of rows/columns entirely. 135 | 136 | ## Events 137 | 138 | Gobless can currently detect two types of events: 139 | 140 | ### Key Press Events 141 | 142 | You can add your own handlers for key presses, utilising the `gobless.Key*` constants. 143 | 144 | For example, to stop rendering the GUI when the user presses `CTRL` + `Q`, you could do: 145 | 146 | ``` 147 | gui.HandleKeyPress(gobless.KeyCtrlQ, func(event gobless.KeyPressEvent){ 148 | gui.Close() 149 | }) 150 | ``` 151 | 152 | ## Terminology 153 | 154 | - A *Cell* refers to an individual terminal cell, in which a single character can be drawn. 155 | - A *Tile* refers to a rectangular grouping of cells. 156 | - A *Component* is an entity which provides a tile - or tiles - to the GUI to render. A bar chart, for example. 157 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/unicode/cldr/cldr.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:generate go run makexml.go -output xml.go 6 | 7 | // Package cldr provides a parser for LDML and related XML formats. 8 | // This package is intended to be used by the table generation tools 9 | // for the various internationalization-related packages. 10 | // As the XML types are generated from the CLDR DTD, and as the CLDR standard 11 | // is periodically amended, this package may change considerably over time. 12 | // This mostly means that data may appear and disappear between versions. 13 | // That is, old code should keep compiling for newer versions, but data 14 | // may have moved or changed. 15 | // CLDR version 22 is the first version supported by this package. 16 | // Older versions may not work. 17 | package cldr // import "golang.org/x/text/unicode/cldr" 18 | 19 | import ( 20 | "fmt" 21 | "sort" 22 | ) 23 | 24 | // CLDR provides access to parsed data of the Unicode Common Locale Data Repository. 25 | type CLDR struct { 26 | parent map[string][]string 27 | locale map[string]*LDML 28 | resolved map[string]*LDML 29 | bcp47 *LDMLBCP47 30 | supp *SupplementalData 31 | } 32 | 33 | func makeCLDR() *CLDR { 34 | return &CLDR{ 35 | parent: make(map[string][]string), 36 | locale: make(map[string]*LDML), 37 | resolved: make(map[string]*LDML), 38 | bcp47: &LDMLBCP47{}, 39 | supp: &SupplementalData{}, 40 | } 41 | } 42 | 43 | // BCP47 returns the parsed BCP47 LDML data. If no such data was parsed, nil is returned. 44 | func (cldr *CLDR) BCP47() *LDMLBCP47 { 45 | return nil 46 | } 47 | 48 | // Draft indicates the draft level of an element. 49 | type Draft int 50 | 51 | const ( 52 | Approved Draft = iota 53 | Contributed 54 | Provisional 55 | Unconfirmed 56 | ) 57 | 58 | var drafts = []string{"unconfirmed", "provisional", "contributed", "approved", ""} 59 | 60 | // ParseDraft returns the Draft value corresponding to the given string. The 61 | // empty string corresponds to Approved. 62 | func ParseDraft(level string) (Draft, error) { 63 | if level == "" { 64 | return Approved, nil 65 | } 66 | for i, s := range drafts { 67 | if level == s { 68 | return Unconfirmed - Draft(i), nil 69 | } 70 | } 71 | return Approved, fmt.Errorf("cldr: unknown draft level %q", level) 72 | } 73 | 74 | func (d Draft) String() string { 75 | return drafts[len(drafts)-1-int(d)] 76 | } 77 | 78 | // SetDraftLevel sets which draft levels to include in the evaluated LDML. 79 | // Any draft element for which the draft level is higher than lev will be excluded. 80 | // If multiple draft levels are available for a single element, the one with the 81 | // lowest draft level will be selected, unless preferDraft is true, in which case 82 | // the highest draft will be chosen. 83 | // It is assumed that the underlying LDML is canonicalized. 84 | func (cldr *CLDR) SetDraftLevel(lev Draft, preferDraft bool) { 85 | // TODO: implement 86 | cldr.resolved = make(map[string]*LDML) 87 | } 88 | 89 | // RawLDML returns the LDML XML for id in unresolved form. 90 | // id must be one of the strings returned by Locales. 91 | func (cldr *CLDR) RawLDML(loc string) *LDML { 92 | return cldr.locale[loc] 93 | } 94 | 95 | // LDML returns the fully resolved LDML XML for loc, which must be one of 96 | // the strings returned by Locales. 97 | func (cldr *CLDR) LDML(loc string) (*LDML, error) { 98 | return cldr.resolve(loc) 99 | } 100 | 101 | // Supplemental returns the parsed supplemental data. If no such data was parsed, 102 | // nil is returned. 103 | func (cldr *CLDR) Supplemental() *SupplementalData { 104 | return cldr.supp 105 | } 106 | 107 | // Locales returns the locales for which there exist files. 108 | // Valid sublocales for which there is no file are not included. 109 | // The root locale is always sorted first. 110 | func (cldr *CLDR) Locales() []string { 111 | loc := []string{"root"} 112 | hasRoot := false 113 | for l, _ := range cldr.locale { 114 | if l == "root" { 115 | hasRoot = true 116 | continue 117 | } 118 | loc = append(loc, l) 119 | } 120 | sort.Strings(loc[1:]) 121 | if !hasRoot { 122 | return loc[1:] 123 | } 124 | return loc 125 | } 126 | 127 | // Get fills in the fields of x based on the XPath path. 128 | func Get(e Elem, path string) (res Elem, err error) { 129 | return walkXPath(e, path) 130 | } 131 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/style.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The TCell Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use file except in compliance with the License. 5 | // You may obtain a copy of the license at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package tcell 16 | 17 | // Style represents a complete text style, including both foreground 18 | // and background color. We encode it in a 64-bit int for efficiency. 19 | // The coding is (MSB): <7b flags><1b><24b fgcolor><7b attr><1b><24b bgcolor>. 20 | // The <1b> is set true to indicate that the color is an RGB color, rather 21 | // than a named index. 22 | // 23 | // This gives 24bit color options, if it ever becomes truly necessary. 24 | // However, applications must not rely on this encoding. 25 | // 26 | // Note that not all terminals can display all colors or attributes, and 27 | // many might have specific incompatibilities between specific attributes 28 | // and color combinations. 29 | // 30 | // The intention is to extend styles to support paletting, in which case 31 | // some flag bit(s) would be set, and the foreground and background colors 32 | // would be replaced with a palette number and palette index. 33 | // 34 | // To use Style, just declare a variable of its type. 35 | type Style int64 36 | 37 | // StyleDefault represents a default style, based upon the context. 38 | // It is the zero value. 39 | const StyleDefault Style = 0 40 | 41 | // styleFlags -- used internally for now. 42 | const ( 43 | styleBgSet = 1 << (iota + 57) 44 | styleFgSet 45 | stylePalette 46 | ) 47 | 48 | // Foreground returns a new style based on s, with the foreground color set 49 | // as requested. ColorDefault can be used to select the global default. 50 | func (s Style) Foreground(c Color) Style { 51 | if c == ColorDefault { 52 | return (s &^ (0x1ffffff00000000 | styleFgSet)) 53 | } 54 | return (s &^ Style(0x1ffffff00000000)) | 55 | ((Style(c) & 0x1ffffff) << 32) | styleFgSet 56 | } 57 | 58 | // Background returns a new style based on s, with the background color set 59 | // as requested. ColorDefault can be used to select the global default. 60 | func (s Style) Background(c Color) Style { 61 | if c == ColorDefault { 62 | return (s &^ (0x1ffffff | styleBgSet)) 63 | } 64 | return (s &^ (0x1ffffff)) | (Style(c) & 0x1ffffff) | styleBgSet 65 | } 66 | 67 | // Decompose breaks a style up, returning the foreground, background, 68 | // and other attributes. 69 | func (s Style) Decompose() (fg Color, bg Color, attr AttrMask) { 70 | if s&styleFgSet != 0 { 71 | fg = Color(s>>32) & 0x1ffffff 72 | } else { 73 | fg = ColorDefault 74 | } 75 | if s&styleBgSet != 0 { 76 | bg = Color(s & 0x1ffffff) 77 | } else { 78 | bg = ColorDefault 79 | } 80 | attr = AttrMask(s) & attrAll 81 | 82 | return fg, bg, attr 83 | } 84 | 85 | func (s Style) setAttrs(attrs Style, on bool) Style { 86 | if on { 87 | return s | attrs 88 | } 89 | return s &^ attrs 90 | } 91 | 92 | // Normal returns the style with all attributes disabled. 93 | func (s Style) Normal() Style { 94 | return s &^ Style(attrAll) 95 | } 96 | 97 | // Bold returns a new style based on s, with the bold attribute set 98 | // as requested. 99 | func (s Style) Bold(on bool) Style { 100 | return s.setAttrs(Style(AttrBold), on) 101 | } 102 | 103 | // Blink returns a new style based on s, with the blink attribute set 104 | // as requested. 105 | func (s Style) Blink(on bool) Style { 106 | return s.setAttrs(Style(AttrBlink), on) 107 | } 108 | 109 | // Dim returns a new style based on s, with the dim attribute set 110 | // as requested. 111 | func (s Style) Dim(on bool) Style { 112 | return s.setAttrs(Style(AttrDim), on) 113 | } 114 | 115 | // Reverse returns a new style based on s, with the reverse attribute set 116 | // as requested. (Reverse usually changes the foreground and background 117 | // colors.) 118 | func (s Style) Reverse(on bool) Style { 119 | return s.setAttrs(Style(AttrReverse), on) 120 | } 121 | 122 | // Underline returns a new style based on s, with the underline attribute set 123 | // as requested. 124 | func (s Style) Underline(on bool) Style { 125 | return s.setAttrs(Style(AttrUnderline), on) 126 | } 127 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/unicode/cldr/slice.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cldr 6 | 7 | import ( 8 | "fmt" 9 | "reflect" 10 | "sort" 11 | ) 12 | 13 | // Slice provides utilities for modifying slices of elements. 14 | // It can be wrapped around any slice of which the element type implements 15 | // interface Elem. 16 | type Slice struct { 17 | ptr reflect.Value 18 | typ reflect.Type 19 | } 20 | 21 | // Value returns the reflect.Value of the underlying slice. 22 | func (s *Slice) Value() reflect.Value { 23 | return s.ptr.Elem() 24 | } 25 | 26 | // MakeSlice wraps a pointer to a slice of Elems. 27 | // It replaces the array pointed to by the slice so that subsequent modifications 28 | // do not alter the data in a CLDR type. 29 | // It panics if an incorrect type is passed. 30 | func MakeSlice(slicePtr interface{}) Slice { 31 | ptr := reflect.ValueOf(slicePtr) 32 | if ptr.Kind() != reflect.Ptr { 33 | panic(fmt.Sprintf("MakeSlice: argument must be pointer to slice, found %v", ptr.Type())) 34 | } 35 | sl := ptr.Elem() 36 | if sl.Kind() != reflect.Slice { 37 | panic(fmt.Sprintf("MakeSlice: argument must point to a slice, found %v", sl.Type())) 38 | } 39 | intf := reflect.TypeOf((*Elem)(nil)).Elem() 40 | if !sl.Type().Elem().Implements(intf) { 41 | panic(fmt.Sprintf("MakeSlice: element type of slice (%v) does not implement Elem", sl.Type().Elem())) 42 | } 43 | nsl := reflect.MakeSlice(sl.Type(), sl.Len(), sl.Len()) 44 | reflect.Copy(nsl, sl) 45 | sl.Set(nsl) 46 | return Slice{ 47 | ptr: ptr, 48 | typ: sl.Type().Elem().Elem(), 49 | } 50 | } 51 | 52 | func (s Slice) indexForAttr(a string) []int { 53 | for i := iter(reflect.Zero(s.typ)); !i.done(); i.next() { 54 | if n, _ := xmlName(i.field()); n == a { 55 | return i.index 56 | } 57 | } 58 | panic(fmt.Sprintf("MakeSlice: no attribute %q for type %v", a, s.typ)) 59 | } 60 | 61 | // Filter filters s to only include elements for which fn returns true. 62 | func (s Slice) Filter(fn func(e Elem) bool) { 63 | k := 0 64 | sl := s.Value() 65 | for i := 0; i < sl.Len(); i++ { 66 | vi := sl.Index(i) 67 | if fn(vi.Interface().(Elem)) { 68 | sl.Index(k).Set(vi) 69 | k++ 70 | } 71 | } 72 | sl.Set(sl.Slice(0, k)) 73 | } 74 | 75 | // Group finds elements in s for which fn returns the same value and groups 76 | // them in a new Slice. 77 | func (s Slice) Group(fn func(e Elem) string) []Slice { 78 | m := make(map[string][]reflect.Value) 79 | sl := s.Value() 80 | for i := 0; i < sl.Len(); i++ { 81 | vi := sl.Index(i) 82 | key := fn(vi.Interface().(Elem)) 83 | m[key] = append(m[key], vi) 84 | } 85 | keys := []string{} 86 | for k, _ := range m { 87 | keys = append(keys, k) 88 | } 89 | sort.Strings(keys) 90 | res := []Slice{} 91 | for _, k := range keys { 92 | nsl := reflect.New(sl.Type()) 93 | nsl.Elem().Set(reflect.Append(nsl.Elem(), m[k]...)) 94 | res = append(res, MakeSlice(nsl.Interface())) 95 | } 96 | return res 97 | } 98 | 99 | // SelectAnyOf filters s to contain only elements for which attr matches 100 | // any of the values. 101 | func (s Slice) SelectAnyOf(attr string, values ...string) { 102 | index := s.indexForAttr(attr) 103 | s.Filter(func(e Elem) bool { 104 | vf := reflect.ValueOf(e).Elem().FieldByIndex(index) 105 | return in(values, vf.String()) 106 | }) 107 | } 108 | 109 | // SelectOnePerGroup filters s to include at most one element e per group of 110 | // elements matching Key(attr), where e has an attribute a that matches any 111 | // the values in v. 112 | // If more than one element in a group matches a value in v preference 113 | // is given to the element that matches the first value in v. 114 | func (s Slice) SelectOnePerGroup(a string, v []string) { 115 | index := s.indexForAttr(a) 116 | grouped := s.Group(func(e Elem) string { return Key(e, a) }) 117 | sl := s.Value() 118 | sl.Set(sl.Slice(0, 0)) 119 | for _, g := range grouped { 120 | e := reflect.Value{} 121 | found := len(v) 122 | gsl := g.Value() 123 | for i := 0; i < gsl.Len(); i++ { 124 | vi := gsl.Index(i).Elem().FieldByIndex(index) 125 | j := 0 126 | for ; j < len(v) && v[j] != vi.String(); j++ { 127 | } 128 | if j < found { 129 | found = j 130 | e = gsl.Index(i) 131 | } 132 | } 133 | if found < len(v) { 134 | sl.Set(reflect.Append(sl, e)) 135 | } 136 | } 137 | } 138 | 139 | // SelectDraft drops all elements from the list with a draft level smaller than d 140 | // and selects the highest draft level of the remaining. 141 | // This method assumes that the input CLDR is canonicalized. 142 | func (s Slice) SelectDraft(d Draft) { 143 | s.SelectOnePerGroup("draft", drafts[len(drafts)-2-int(d):]) 144 | } 145 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/unicode/cldr/decode.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cldr 6 | 7 | import ( 8 | "archive/zip" 9 | "bytes" 10 | "encoding/xml" 11 | "fmt" 12 | "io" 13 | "io/ioutil" 14 | "log" 15 | "os" 16 | "path/filepath" 17 | "regexp" 18 | ) 19 | 20 | // A Decoder loads an archive of CLDR data. 21 | type Decoder struct { 22 | dirFilter []string 23 | sectionFilter []string 24 | loader Loader 25 | cldr *CLDR 26 | curLocale string 27 | } 28 | 29 | // SetSectionFilter takes a list top-level LDML element names to which 30 | // evaluation of LDML should be limited. It automatically calls SetDirFilter. 31 | func (d *Decoder) SetSectionFilter(filter ...string) { 32 | d.sectionFilter = filter 33 | // TODO: automatically set dir filter 34 | } 35 | 36 | // SetDirFilter limits the loading of LDML XML files of the specied directories. 37 | // Note that sections may be split across directories differently for different CLDR versions. 38 | // For more robust code, use SetSectionFilter. 39 | func (d *Decoder) SetDirFilter(dir ...string) { 40 | d.dirFilter = dir 41 | } 42 | 43 | // A Loader provides access to the files of a CLDR archive. 44 | type Loader interface { 45 | Len() int 46 | Path(i int) string 47 | Reader(i int) (io.ReadCloser, error) 48 | } 49 | 50 | var fileRe = regexp.MustCompile(`.*[/\\](.*)[/\\](.*)\.xml`) 51 | 52 | // Decode loads and decodes the files represented by l. 53 | func (d *Decoder) Decode(l Loader) (cldr *CLDR, err error) { 54 | d.cldr = makeCLDR() 55 | for i := 0; i < l.Len(); i++ { 56 | fname := l.Path(i) 57 | if m := fileRe.FindStringSubmatch(fname); m != nil { 58 | if len(d.dirFilter) > 0 && !in(d.dirFilter, m[1]) { 59 | continue 60 | } 61 | var r io.Reader 62 | if r, err = l.Reader(i); err == nil { 63 | err = d.decode(m[1], m[2], r) 64 | } 65 | if err != nil { 66 | return nil, err 67 | } 68 | } 69 | } 70 | d.cldr.finalize(d.sectionFilter) 71 | return d.cldr, nil 72 | } 73 | 74 | func (d *Decoder) decode(dir, id string, r io.Reader) error { 75 | var v interface{} 76 | var l *LDML 77 | cldr := d.cldr 78 | switch { 79 | case dir == "supplemental": 80 | v = cldr.supp 81 | case dir == "transforms": 82 | return nil 83 | case dir == "bcp47": 84 | v = cldr.bcp47 85 | case dir == "validity": 86 | return nil 87 | default: 88 | ok := false 89 | if v, ok = cldr.locale[id]; !ok { 90 | l = &LDML{} 91 | v, cldr.locale[id] = l, l 92 | } 93 | } 94 | x := xml.NewDecoder(r) 95 | if err := x.Decode(v); err != nil { 96 | log.Printf("%s/%s: %v", dir, id, err) 97 | return err 98 | } 99 | if l != nil { 100 | if l.Identity == nil { 101 | return fmt.Errorf("%s/%s: missing identity element", dir, id) 102 | } 103 | // TODO: verify when CLDR bug http://unicode.org/cldr/trac/ticket/8970 104 | // is resolved. 105 | // path := strings.Split(id, "_") 106 | // if lang := l.Identity.Language.Type; lang != path[0] { 107 | // return fmt.Errorf("%s/%s: language was %s; want %s", dir, id, lang, path[0]) 108 | // } 109 | } 110 | return nil 111 | } 112 | 113 | type pathLoader []string 114 | 115 | func makePathLoader(path string) (pl pathLoader, err error) { 116 | err = filepath.Walk(path, func(path string, _ os.FileInfo, err error) error { 117 | pl = append(pl, path) 118 | return err 119 | }) 120 | return pl, err 121 | } 122 | 123 | func (pl pathLoader) Len() int { 124 | return len(pl) 125 | } 126 | 127 | func (pl pathLoader) Path(i int) string { 128 | return pl[i] 129 | } 130 | 131 | func (pl pathLoader) Reader(i int) (io.ReadCloser, error) { 132 | return os.Open(pl[i]) 133 | } 134 | 135 | // DecodePath loads CLDR data from the given path. 136 | func (d *Decoder) DecodePath(path string) (cldr *CLDR, err error) { 137 | loader, err := makePathLoader(path) 138 | if err != nil { 139 | return nil, err 140 | } 141 | return d.Decode(loader) 142 | } 143 | 144 | type zipLoader struct { 145 | r *zip.Reader 146 | } 147 | 148 | func (zl zipLoader) Len() int { 149 | return len(zl.r.File) 150 | } 151 | 152 | func (zl zipLoader) Path(i int) string { 153 | return zl.r.File[i].Name 154 | } 155 | 156 | func (zl zipLoader) Reader(i int) (io.ReadCloser, error) { 157 | return zl.r.File[i].Open() 158 | } 159 | 160 | // DecodeZip loads CLDR data from the zip archive for which r is the source. 161 | func (d *Decoder) DecodeZip(r io.Reader) (cldr *CLDR, err error) { 162 | buffer, err := ioutil.ReadAll(r) 163 | if err != nil { 164 | return nil, err 165 | } 166 | archive, err := zip.NewReader(bytes.NewReader(buffer), int64(len(buffer))) 167 | if err != nil { 168 | return nil, err 169 | } 170 | return d.Decode(zipLoader{archive}) 171 | } 172 | -------------------------------------------------------------------------------- /barchart.go: -------------------------------------------------------------------------------- 1 | package gobless 2 | 3 | import ( 4 | "image" 5 | "math" 6 | ) 7 | 8 | type BarChart struct { 9 | width int 10 | height int 11 | x int 12 | y int 13 | wrap bool 14 | style Style 15 | barstyle Style 16 | borderColor Color 17 | title string 18 | bars []barChartBar 19 | space bool 20 | yScale int 21 | } 22 | 23 | type barChartBar struct { 24 | Name string 25 | Value int 26 | } 27 | 28 | func NewBarChart() *BarChart { 29 | return &BarChart{ 30 | style: DefaultStyle, 31 | barstyle: NewStyle(ColorDarkBlue, ColorWhite), 32 | borderColor: ColorDarkCyan, 33 | bars: []barChartBar{}, 34 | space: true, 35 | } 36 | } 37 | 38 | func (barchart *BarChart) SetBarSpacing(space bool) { 39 | barchart.space = space 40 | } 41 | func (barchart *BarChart) SetYScale(scale int) { 42 | barchart.yScale = scale 43 | } 44 | func (barchart *BarChart) SetTitle(title string) { 45 | barchart.title = title 46 | } 47 | func (barchart *BarChart) SetBorderColor(color Color) { 48 | barchart.borderColor = color 49 | } 50 | 51 | func (barchart *BarChart) SetBar(name string, value int) { 52 | 53 | for i, bar := range barchart.bars { 54 | if bar.Name == name { 55 | barchart.bars[i].Value = value 56 | return 57 | } 58 | } 59 | 60 | barchart.bars = append(barchart.bars, barChartBar{name, value}) 61 | } 62 | 63 | func (barchart *BarChart) SetX(x int) { 64 | barchart.x = x 65 | } 66 | func (barchart *BarChart) SetY(y int) { 67 | barchart.y = y 68 | } 69 | func (barchart *BarChart) SetWidth(w int) { 70 | barchart.width = w 71 | } 72 | func (barchart *BarChart) SetHeight(h int) { 73 | barchart.height = h 74 | } 75 | 76 | func (component *BarChart) SetTextWrap(enabled bool) { 77 | component.wrap = enabled 78 | } 79 | func (component *BarChart) SetStyle(style Style) { 80 | component.style = style 81 | } 82 | func (component *BarChart) SetBarStyle(style Style) { 83 | component.barstyle = style 84 | } 85 | 86 | func (barchart *BarChart) GetTiles(gui *GUI) []Tile { 87 | 88 | tile := NewTile(barchart.x+1, barchart.y+1, barchart.x+barchart.width-2, barchart.y+barchart.height-2) 89 | 90 | maxRenderWidth := barchart.width - 2 91 | 92 | startX := 0 93 | 94 | // bar area = bar width + bar spacing 95 | 96 | widthPerBarAreaFloat := float64(maxRenderWidth) / float64(len(barchart.bars)) 97 | widthPerBarArea := int(math.Floor(widthPerBarAreaFloat)) 98 | widthPerBar := widthPerBarArea 99 | 100 | if barchart.space && widthPerBar > 1 { 101 | widthPerBar = widthPerBar - 1 102 | } 103 | 104 | leftoverChars := maxRenderWidth - (widthPerBarArea * len(barchart.bars)) 105 | 106 | startX = int(leftoverChars / 2) 107 | 108 | maxBarHeight := barchart.height - 3 109 | 110 | maxValue := barchart.yScale 111 | 112 | if maxValue == 0 { 113 | for _, bar := range barchart.bars { 114 | if bar.Value > maxValue { 115 | maxValue = bar.Value 116 | } 117 | } 118 | } 119 | 120 | for index, bar := range barchart.bars { 121 | 122 | barHeight := int(math.Round( 123 | (float64(bar.Value) / float64(maxValue)) * float64(maxBarHeight), 124 | )) 125 | 126 | if barHeight > maxBarHeight { 127 | barHeight = maxBarHeight 128 | } else if barHeight < 0 { 129 | barHeight = 0 130 | } 131 | 132 | barTopOffset := maxBarHeight - barHeight 133 | 134 | tile.SetCells( 135 | image.Rect(startX, 0, startX+widthPerBar-1, maxBarHeight-1), 136 | NewCell(' ', barchart.style), 137 | ) 138 | 139 | if barHeight > 0 { 140 | tile.SetCells( 141 | image.Rect(startX, barTopOffset, startX+widthPerBar-1, maxBarHeight-1), 142 | NewCell(' ', barchart.barstyle), 143 | ) 144 | 145 | label := shortenInt(bar.Value) 146 | 147 | for p := 0; p < len(label) && p < widthPerBar; p++ { 148 | tile.SetCell(image.Point{X: startX + p, Y: barTopOffset}, NewCell([]rune(label)[p], barchart.barstyle)) 149 | } 150 | } else { 151 | label := shortenInt(bar.Value) 152 | 153 | for p := 0; p < len(label) && p < widthPerBar; p++ { 154 | tile.SetCell(image.Point{X: startX + p, Y: barTopOffset - 1}, NewCell([]rune(label)[p], barchart.style)) 155 | } 156 | } 157 | 158 | for p := 0; p < widthPerBar; p++ { 159 | if p < len(bar.Name) { 160 | tile.SetCell(image.Point{X: startX + p, Y: maxBarHeight}, NewCell([]rune(bar.Name)[p], barchart.style)) 161 | } else { 162 | tile.SetCell(image.Point{X: startX + p, Y: maxBarHeight}, NewCell(' ', barchart.style)) 163 | } 164 | } 165 | 166 | startX += widthPerBarArea 167 | index++ 168 | } 169 | 170 | border := NewBorder() 171 | border.SetX(barchart.x) 172 | border.SetY(barchart.y) 173 | border.SetWidth(barchart.width) 174 | border.SetHeight(barchart.height) 175 | border.SetText(barchart.title) 176 | border.SetStyle(NewStyle(barchart.style.BackgroundColor, barchart.borderColor)) 177 | return append([]Tile{tile}, border.GetTiles(gui)...) 178 | } 179 | -------------------------------------------------------------------------------- /vendor/github.com/gdamore/tcell/terminfo/mkdatabase.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2017 The TCell Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use file except in compliance with the License. 7 | # You may obtain a copy of the license at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # 18 | # When called with no arguments, this shell script builds the Go database, 19 | # which is somewhat minimal for size reasons (it only contains the most 20 | # commonly used entries), and then builds the complete JSON database. 21 | # 22 | # To limit the action to only building one or more terminals, specify them 23 | # on the command line: 24 | # 25 | # ./mkdatabase xterm 26 | # 27 | # The script will also find and update or add any terminal "aliases". 28 | # It does not remove any old entries. 29 | # 30 | # To add to the set of terminals that we compile into the Go database, 31 | # add their names to the models.txt file. 32 | # 33 | 34 | # This script is not very efficient, but there isn't really a better way 35 | # without writing code to decode the terminfo binary format directly. 36 | # Its not worth worrying about. 37 | 38 | # This script also requires bash, although ksh93 should work as well, because 39 | # we use arrays, which are not specified in POSIX. 40 | 41 | export LANG=C 42 | export LC_CTYPE=C 43 | 44 | progress() 45 | { 46 | typeset -i num=$1 47 | typeset -i tot=$2 48 | typeset -i x 49 | typeset back 50 | typeset s 51 | 52 | if (( tot < 1 )) 53 | then 54 | s=$(printf "[ %d ]" $num) 55 | back="\b\b\b\b\b" 56 | x=$num 57 | while (( x >= 10 )) 58 | do 59 | back="${back}\b" 60 | x=$(( x / 10 )) 61 | done 62 | 63 | else 64 | x=$(( num * 100 / tot )) 65 | s=$(printf "<%3d%%>" $x) 66 | back="\b\b\b\b\b\b" 67 | fi 68 | printf "%s${back}" "$s" 69 | } 70 | 71 | ord() 72 | { 73 | printf "%02x" "'$1'" 74 | } 75 | 76 | goterms=( $(cat models.txt) ) 77 | args=( $* ) 78 | if (( ${#args[@]} == 0 )) 79 | then 80 | args=( $(toe -a | cut -f1) ) 81 | fi 82 | 83 | printf "Scanning terminal definitions: " 84 | i=0 85 | aliases=() 86 | models=() 87 | for term in ${args[@]} 88 | do 89 | case "${term}" in 90 | *-truecolor) 91 | line="${term}|24-bit color" 92 | ;; 93 | *) 94 | line=$(infocmp $term | head -2 | tail -1) 95 | if [[ -z "$line" ]] 96 | then 97 | echo "Cannot find terminfo for $term" 98 | exit 1 99 | fi 100 | # take off the trailing comma 101 | line=${line%,} 102 | esac 103 | 104 | # grab primary name 105 | term=${line%%|*} 106 | all+=( ${term} ) 107 | 108 | # should this be in our go terminals? 109 | for model in ${goterms[@]} 110 | do 111 | if [[ "${model}" == "${term}" ]] 112 | then 113 | models+=( ${term} ) 114 | fi 115 | done 116 | 117 | # chop off primary name 118 | line=${line#${term}} 119 | line=${line#|} 120 | # chop off description 121 | line=${line%|*} 122 | while [[ "$line" != "" ]] 123 | do 124 | a=${line%%|*} 125 | aliases+=( ${a}=${term} ) 126 | line=${line#$a} 127 | line=${line#|} 128 | done 129 | i=$(( i + 1 )) 130 | progress $i ${#args[@]} 131 | done 132 | echo 133 | # make sure we have mkinfo 134 | printf "Building mkinfo: " 135 | go build mkinfo.go 136 | echo "done." 137 | 138 | # Build all the go database files for the "interesting" terminals". 139 | printf "Building Go database: " 140 | i=0 141 | for model in ${models[@]} 142 | do 143 | safe=$(echo $model | tr - _) 144 | file=term_${safe}.go 145 | ./mkinfo -go $file $model 146 | go fmt ${file} >/dev/null 147 | i=$(( i + 1 )) 148 | progress $i ${#models[@]} 149 | done 150 | echo 151 | 152 | printf "Building JSON database: " 153 | 154 | # The JSON files are located for each terminal in a file with the 155 | # terminal name, in the following fashion "database/x/xterm.json 156 | 157 | i=0 158 | for model in ${all[@]} 159 | do 160 | letter=$(ord ${model:0:1}) 161 | dir=database/${letter} 162 | file=${dir}/${model}.gz 163 | mkdir -p ${dir} 164 | ./mkinfo -nofatal -quiet -gzip -json ${file} ${model} 165 | i=$(( i + 1 )) 166 | progress $i ${#all[@]} 167 | done 168 | echo 169 | 170 | printf "Building JSON aliases: " 171 | i=0 172 | for model in ${aliases[@]} 173 | do 174 | canon=${model#*=} 175 | model=${model%=*} 176 | letter=$(ord ${model:0:1}) 177 | cletter=$(ord ${canon:0:1}) 178 | dir=database/${letter} 179 | file=${dir}/${model} 180 | if [[ -f database/${cletter}/${canon}.gz ]] 181 | then 182 | [[ -d ${dir} ]] || mkdir -p ${dir} 183 | # Generally speaking the aliases are better uncompressed 184 | ./mkinfo -nofatal -quiet -json ${file} ${model} 185 | fi 186 | i=$(( i + 1 )) 187 | progress $i ${#aliases[@]} 188 | done 189 | echo 190 | --------------------------------------------------------------------------------