diff --git a/vendor/github.com/gdamore/tcell/v2/README.md b/vendor/github.com/gdamore/tcell/v2/README.md index b7727e081..1d422e984 100644 --- a/vendor/github.com/gdamore/tcell/v2/README.md +++ b/vendor/github.com/gdamore/tcell/v2/README.md @@ -4,14 +4,12 @@ _Tcell_ is a _Go_ package that provides a cell based view for text terminals, like _XTerm_. It was inspired by _termbox_, but includes many additional improvements. -[![Linux Status](https://img.shields.io/travis/gdamore/tcell.svg?label=linux)](https://travis-ci.org/gdamore/tcell) -[![Windows Status](https://img.shields.io/appveyor/ci/gdamore/tcell.svg?label=windows)](https://ci.appveyor.com/project/gdamore/tcell) -[![Apache License](https://img.shields.io/badge/license-APACHE2-blue.svg)](https://github.com/gdamore/tcell/blob/master/LICENSE) -[![Documentation](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/gdamore/tcell/v2) -[![Report Card](https://goreportcard.com/badge/gdamore/tcell)](http://goreportcard.com/report/gdamore/tcell/v2) -[![Discord](https://img.shields.io/discord/639503822733180969?label=discord)](https://discord.gg/urTTxDN) -[![Coverage](https://codecov.io/gh/gdamore/tcell/branch/master/graph/badge.svg)](https://codecov.io/gh/gdamore/tcell) - +[![Linux](https://img.shields.io/github/workflow/status/gdamore/tcell/linux?logoColor=grey&logo=linux&label=)](https://github.com/gdamore/tcell/actions/workflows/linux.yml) +[![Windows](https://img.shields.io/github/workflow/status/gdamore/tcell/windows?logoColor=grey&logo=windows&label=)](https://github.com/gdamore/tcell/actions/workflows/windows.yml) +[![Apache License](https://img.shields.io/github/license/gdamore/tcell.svg?logoColor=silver&logo=opensourceinitiative&color=blue&label=)](https://github.com/gdamore/tcell/blob/master/LICENSE) +[![Docs](https://img.shields.io/badge/godoc-reference-blue.svg?label=&logo=go)](https://pkg.go.dev/github.com/gdamore/tcell/v2) +[![Discord](https://img.shields.io/discord/639503822733180969?label=&logo=discord)](https://discord.gg/urTTxDN) +[![Coverage](https://img.shields.io/codecov/c/github/gdamore/tcell?logoColor=grey&logo=codecov&label=)](https://codecov.io/gh/gdamore/tcell) NOTE: This is version 2 of _Tcell_. There are breaking changes relative to version 1. Version 1.x remains available using the import `github.com/gdamore/tcell`. @@ -55,6 +53,10 @@ A brief, and still somewhat rough, [tutorial](TUTORIAL.md) is available. * [tmux-wormhole](https://github.com/gcla/tmux-wormhole) - _tmux_ plugin to transfer files * [gruid-tcell](https://github.com/anaseto/gruid-tcell) - driver for the grid based UI and game framework * [aretext](https://github.com/aretext/aretext) - minimalist text editor with _vim_ key bindings +* [sync](https://github.com/kyprifog/sync) - github repo synchronization tool +* [statusbar](https://github.com/kyprifog/statusbar) - statusbar motivation tool for tracking periodic tasks/goals +* [todo](https://github.com/kyprifog/todo) - simple todo app + ## Pure Go Terminfo Database diff --git a/vendor/github.com/gdamore/tcell/v2/go.mod b/vendor/github.com/gdamore/tcell/v2/go.mod index af97fa00b..ac4b10db4 100644 --- a/vendor/github.com/gdamore/tcell/v2/go.mod +++ b/vendor/github.com/gdamore/tcell/v2/go.mod @@ -4,9 +4,9 @@ go 1.12 require ( github.com/gdamore/encoding v1.0.0 - github.com/lucasb-eyer/go-colorful v1.0.3 - github.com/mattn/go-runewidth v0.0.10 + github.com/lucasb-eyer/go-colorful v1.2.0 + github.com/mattn/go-runewidth v0.0.13 golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf - golang.org/x/text v0.3.0 + golang.org/x/text v0.3.7 ) diff --git a/vendor/github.com/gdamore/tcell/v2/go.sum b/vendor/github.com/gdamore/tcell/v2/go.sum index 068fabd98..b25da2aa5 100644 --- a/vendor/github.com/gdamore/tcell/v2/go.sum +++ b/vendor/github.com/gdamore/tcell/v2/go.sum @@ -1,14 +1,16 @@ github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= -github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= -github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg= -github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= -github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= -github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= +github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= +github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= +github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/vendor/github.com/gdamore/tcell/v2/screen.go b/vendor/github.com/gdamore/tcell/v2/screen.go index cbe505f9e..15cfbf022 100644 --- a/vendor/github.com/gdamore/tcell/v2/screen.go +++ b/vendor/github.com/gdamore/tcell/v2/screen.go @@ -76,7 +76,7 @@ type Screen interface { // Size returns the screen size as width, height. This changes in // response to a call to Clear or Flush. - Size() (int, int) + Size() (width, height int) // ChannelEvents is an infinite loop that waits for an event and // channels it into the user provided channel ch. Closing the diff --git a/vendor/github.com/gdamore/tcell/v2/tscreen.go b/vendor/github.com/gdamore/tcell/v2/tscreen.go index ebd61a258..d0f73e54e 100644 --- a/vendor/github.com/gdamore/tcell/v2/tscreen.go +++ b/vendor/github.com/gdamore/tcell/v2/tscreen.go @@ -46,19 +46,36 @@ func NewTerminfoScreen() (Screen, error) { return NewTerminfoScreenFromTty(nil) } -// NewTerminfoScreenFromTty returns a Screen using a custom Tty implementation. -// If the passed in tty is nil, then a reasonable default (typically /dev/tty) -// is presumed, at least on UNIX hosts. (Windows hosts will typically fail this -// call altogether.) -func NewTerminfoScreenFromTty(tty Tty) (Screen, error) { - ti, e := terminfo.LookupTerminfo(os.Getenv("TERM")) +// LookupTerminfo attempts to find a definition for the named $TERM falling +// back to attempting to parse the output from infocmp. +func LookupTerminfo(name string) (ti *terminfo.Terminfo, e error) { + ti, e = terminfo.LookupTerminfo(name) if e != nil { - ti, e = loadDynamicTerminfo(os.Getenv("TERM")) + ti, e = loadDynamicTerminfo(name) if e != nil { return nil, e } terminfo.AddTerminfo(ti) } + + return +} + +// NewTerminfoScreenFromTtyTerminfo returns a Screen using a custom Tty +// implementation and custom terminfo specification. +// If the passed in tty is nil, then a reasonable default (typically /dev/tty) +// is presumed, at least on UNIX hosts. (Windows hosts will typically fail this +// call altogether.) +// If passed terminfo is nil, then TERM environment variable is queried for +// terminal specification. +func NewTerminfoScreenFromTtyTerminfo(tty Tty, ti *terminfo.Terminfo) (s Screen, e error) { + if ti == nil { + ti, e = LookupTerminfo(os.Getenv("TERM")) + if e != nil { + return + } + } + t := &tScreen{ti: ti, tty: tty} t.keyexist = make(map[Key]bool) @@ -77,6 +94,14 @@ func NewTerminfoScreenFromTty(tty Tty) (Screen, error) { return t, nil } +// NewTerminfoScreenFromTty returns a Screen using a custom Tty implementation. +// If the passed in tty is nil, then a reasonable default (typically /dev/tty) +// is presumed, at least on UNIX hosts. (Windows hosts will typically fail this +// call altogether.) +func NewTerminfoScreenFromTty(tty Tty) (Screen, error) { + return NewTerminfoScreenFromTtyTerminfo(tty, nil) +} + // tKeyCode represents a combination of a key code and modifiers. type tKeyCode struct { key Key @@ -844,7 +869,7 @@ func (t *tScreen) EnableMouse(flags ...MouseFlags) { flagsPresent = true } if !flagsPresent { - f = MouseMotionEvents + f = MouseMotionEvents | MouseDragEvents | MouseButtonEvents } t.Lock() @@ -860,14 +885,19 @@ func (t *tScreen) enableMouse(f MouseFlags) { if len(t.mouse) != 0 { // start by disabling all tracking. t.TPuts("\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l") - if f&MouseMotionEvents != 0 { - t.TPuts("\x1b[?1003h\x1b[?1006h") - } else if f&MouseDragEvents != 0 { - t.TPuts("\x1b[?1002h\x1b[?1006h") - } else if f&MouseButtonEvents != 0 { - t.TPuts("\x1b[?1000h\x1b[?1006h") + if f&MouseButtonEvents != 0 { + t.TPuts("\x1b[?1000h") } + if f&MouseDragEvents != 0 { + t.TPuts("\x1b[?1002h") + } + if f&MouseMotionEvents != 0 { + t.TPuts("\x1b[?1003h") + } + + t.TPuts("\x1b[?1006h") } + } func (t *tScreen) DisableMouse() { @@ -1547,7 +1577,12 @@ func (t *tScreen) inputLoop(stopQ chan struct{}) { switch e { case nil: default: - _ = t.PostEvent(NewEventError(e)) + t.Lock() + running := t.running + t.Unlock() + if running { + _ = t.PostEvent(NewEventError(e)) + } return } if n > 0 { diff --git a/vendor/github.com/gdamore/tcell/v2/tty_unix.go b/vendor/github.com/gdamore/tcell/v2/tty_unix.go index 0c6ea7849..dbd961bbf 100644 --- a/vendor/github.com/gdamore/tcell/v2/tty_unix.go +++ b/vendor/github.com/gdamore/tcell/v2/tty_unix.go @@ -72,7 +72,7 @@ func (tty *devTty) Start() error { if tty.f, err = os.OpenFile(tty.dev, os.O_RDWR, 0); err != nil { return err } - tty.fd = int(tty.of.Fd()) + tty.fd = int(tty.f.Fd()) if !term.IsTerminal(tty.fd) { return errors.New("device is not a terminal") diff --git a/vendor/modules.txt b/vendor/modules.txt index 7ff1bc5f0..b93c58934 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -33,7 +33,8 @@ github.com/fatih/color github.com/fsnotify/fsnotify # github.com/gdamore/encoding v1.0.0 github.com/gdamore/encoding -# github.com/gdamore/tcell/v2 v2.4.0 +# github.com/gdamore/tcell/v2 v2.4.1-0.20210926162909-66f061b1fc9b +## explicit github.com/gdamore/tcell/v2 github.com/gdamore/tcell/v2/terminfo github.com/gdamore/tcell/v2/terminfo/a/aixterm