summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/gdamore
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/gdamore')
-rw-r--r--vendor/github.com/gdamore/tcell/v2/README.adoc11
-rw-r--r--vendor/github.com/gdamore/tcell/v2/console_win.go149
-rw-r--r--vendor/github.com/gdamore/tcell/v2/go.mod5
-rw-r--r--vendor/github.com/gdamore/tcell/v2/go.sum10
-rw-r--r--vendor/github.com/gdamore/tcell/v2/nonblock_bsd.go50
-rw-r--r--vendor/github.com/gdamore/tcell/v2/nonblock_stub.go21
-rw-r--r--vendor/github.com/gdamore/tcell/v2/nonblock_unix.go52
-rw-r--r--vendor/github.com/gdamore/tcell/v2/screen.go29
-rw-r--r--vendor/github.com/gdamore/tcell/v2/simulation.go12
-rw-r--r--vendor/github.com/gdamore/tcell/v2/terminfo/a/alacritty/term.go1
-rw-r--r--vendor/github.com/gdamore/tcell/v2/terminfo/dynamic/dynamic.go22
-rw-r--r--vendor/github.com/gdamore/tcell/v2/terminfo/g/gnome/term.go2
-rw-r--r--vendor/github.com/gdamore/tcell/v2/terminfo/k/konsole/term.go2
-rw-r--r--vendor/github.com/gdamore/tcell/v2/terminfo/k/kterm/term.go1
-rw-r--r--vendor/github.com/gdamore/tcell/v2/terminfo/l/linux/term.go1
-rw-r--r--vendor/github.com/gdamore/tcell/v2/terminfo/r/rxvt/term.go5
-rw-r--r--vendor/github.com/gdamore/tcell/v2/terminfo/s/screen/term.go2
-rw-r--r--vendor/github.com/gdamore/tcell/v2/terminfo/s/simpleterm/term.go2
-rw-r--r--vendor/github.com/gdamore/tcell/v2/terminfo/t/termite/term.go1
-rw-r--r--vendor/github.com/gdamore/tcell/v2/terminfo/t/tmux/term.go2
-rw-r--r--vendor/github.com/gdamore/tcell/v2/terminfo/terminfo.go1
-rw-r--r--vendor/github.com/gdamore/tcell/v2/terminfo/x/xfce/term.go1
-rw-r--r--vendor/github.com/gdamore/tcell/v2/terminfo/x/xterm/term.go3
-rw-r--r--vendor/github.com/gdamore/tcell/v2/terminfo/x/xterm_kitty/term.go1
-rw-r--r--vendor/github.com/gdamore/tcell/v2/terminfo/x/xterm_termite/term.go1
-rw-r--r--vendor/github.com/gdamore/tcell/v2/tscreen.go143
-rw-r--r--vendor/github.com/gdamore/tcell/v2/tscreen_bsd.go121
-rw-r--r--vendor/github.com/gdamore/tcell/v2/tscreen_darwin.go142
-rw-r--r--vendor/github.com/gdamore/tcell/v2/tscreen_linux.go147
-rw-r--r--vendor/github.com/gdamore/tcell/v2/tscreen_solaris.go122
-rw-r--r--vendor/github.com/gdamore/tcell/v2/tscreen_stub.go19
-rw-r--r--vendor/github.com/gdamore/tcell/v2/tscreen_unix.go123
-rw-r--r--vendor/github.com/gdamore/tcell/v2/tscreen_windows.go44
33 files changed, 524 insertions, 724 deletions
diff --git a/vendor/github.com/gdamore/tcell/v2/README.adoc b/vendor/github.com/gdamore/tcell/v2/README.adoc
index c49da3213..15f390ff3 100644
--- a/vendor/github.com/gdamore/tcell/v2/README.adoc
+++ b/vendor/github.com/gdamore/tcell/v2/README.adoc
@@ -28,8 +28,8 @@ Version 1.x remains available using the import `github.com/gdamore/tcell`.
* https://github.com/gdamore/gomatrix[gomatrix] - converted from Termbox
* https://github.com/zyedidia/micro/[micro] - lightweight text editor with syntax-highlighting and themes
* https://github.com/viktomas/godu[godu] - simple golang utility helping to discover large files/folders.
-* https://github.com/rivo/tview[tview] - rich interactive widgets for terminal UIs
-* https://github.com/marcusolsson/tui-go[tui-go] - UI library for terminal apps (_deprecated_)
+* https://github.com/rivo/tview/[tview] - rich interactive widgets for terminal UIs
+* https://github.com/awesome-gocui/gocui[awesome gocui] - Go Console User Interface
* https://github.com/rgm3/gomandelbrot[gomandelbrot] - Mandelbrot!
* https://github.com/senorprogrammer/wtf[WTF]- Personal information dashboard for your terminal
* https://github.com/browsh-org/browsh[browsh] - A fully-modern text-based browser, rendering to TTY and browsers (https://www.youtube.com/watch?v=HZq86XfBoRo[video])
@@ -48,6 +48,9 @@ Version 1.x remains available using the import `github.com/gdamore/tcell`.
* https://github.com/Bios-Marcel/memoryalike[memoryalike] - A game where you have to memorize runes and hit their respective keys
* https://github.com/gokcehan/lf[lf] - Terminal file manager
* https://github.com/bunyk/gokeybr[gokeybr] - program that helps to deliberately practice your typing.
+* https://github.com/jbaramidze/gonano[gonano] - CLI test editor
+* https://github.com/tmountain/uchess[uchess] - A UCI chess client for your terminal
+* https://github.com/a-h/min[min] - A Gemini browser
== Pure Go Terminfo Database
@@ -246,9 +249,7 @@ platforms (e.g. AIX) may need to be added. Pull requests are welcome!
=== Windows
-Windows console mode applications are supported. Unfortunately _mintty_
-and other _cygwin_ style applications are not supported, and are
-unlikely to be supportable due to limitations in their design.
+Windows console mode applications are supported.
Modern console applications like ConEmu and the Windows 10 terminal,
support all the good features (resize, mouse tracking, etc.)
diff --git a/vendor/github.com/gdamore/tcell/v2/console_win.go b/vendor/github.com/gdamore/tcell/v2/console_win.go
index 0c2493baa..ce2185313 100644
--- a/vendor/github.com/gdamore/tcell/v2/console_win.go
+++ b/vendor/github.com/gdamore/tcell/v2/console_win.go
@@ -1,6 +1,6 @@
// +build windows
-// Copyright 2020 The TCell Authors
+// Copyright 2021 The TCell Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License.
@@ -53,6 +53,10 @@ type cScreen struct {
finiOnce sync.Once
+ mouseEnabled bool
+ wg sync.WaitGroup
+ stopQ chan struct{}
+
sync.Mutex
}
@@ -176,7 +180,7 @@ func (s *cScreen) Init() error {
// ConEmu handling of colors and scrolling when in terminal
// mode is extremely problematic at the best. The color
// palette will scroll even though characters do not, when
- // emiting stuff for the last character. In the future we
+ // emitting stuff for the last character. In the future we
// might change this to look at specific versions of ConEmu
// if they fix the bug.
if os.Getenv("ConEmuPID") != "" {
@@ -189,16 +193,6 @@ func (s *cScreen) Init() error {
s.truecolor = true
}
- cf, _, e := procCreateEvent.Call(
- uintptr(0),
- uintptr(1),
- uintptr(0),
- uintptr(0))
- if cf == uintptr(0) {
- return e
- }
- s.cancelflag = syscall.Handle(cf)
-
s.Lock()
s.curx = -1
@@ -229,12 +223,9 @@ func (s *cScreen) Init() error {
s.setOutMode(0)
}
- s.clearScreen(s.style)
- s.hideCursor()
s.Unlock()
- go s.scanInput()
- return nil
+ return s.engage()
}
func (s *cScreen) CharacterSet() string {
@@ -242,20 +233,36 @@ func (s *cScreen) CharacterSet() string {
return "UTF-16LE"
}
-func (s *cScreen) EnableMouse() {
- s.setInMode(modeResizeEn | modeMouseEn | modeExtndFlg)
+func (s *cScreen) EnableMouse(...MouseFlags) {
+ s.Lock()
+ s.mouseEnabled = true
+ s.enableMouse(true)
+ s.Unlock()
}
func (s *cScreen) DisableMouse() {
- s.setInMode(modeResizeEn | modeExtndFlg)
+ s.Lock()
+ s.mouseEnabled = false
+ s.enableMouse(false)
+ s.Unlock()
+}
+
+func (s *cScreen) enableMouse(on bool) {
+ if on {
+ s.setInMode(modeResizeEn | modeMouseEn | modeExtndFlg)
+ } else {
+ s.setInMode(modeResizeEn | modeExtndFlg)
+ }
}
+// Windows lacks bracketed paste (for now)
+
func (s *cScreen) EnablePaste() {}
func (s *cScreen) DisablePaste() {}
func (s *cScreen) Fini() {
- s.finiOnce.Do(s.finish)
+ s.disengage()
}
func (s *cScreen) finish() {
@@ -271,8 +278,8 @@ func (s *cScreen) finish() {
s.setInMode(s.oimode)
s.setOutMode(s.oomode)
s.setBufferSize(int(s.oscreen.size.x), int(s.oscreen.size.y))
- s.clearScreen(StyleDefault)
- s.setCursorPos(0, 0)
+ s.clearScreen(StyleDefault, false)
+ s.setCursorPos(0, 0, false)
procSetConsoleTextAttribute.Call(
uintptr(s.out),
uintptr(s.mapStyle(StyleDefault)))
@@ -286,6 +293,68 @@ func (s *cScreen) finish() {
syscall.Close(s.out)
}
+func (s *cScreen) disengage() {
+ s.Lock()
+ stopQ := s.stopQ
+ if stopQ == nil {
+ s.Unlock()
+ return
+ }
+ s.stopQ = nil
+ procSetEvent.Call(uintptr(s.cancelflag))
+ close(stopQ)
+ s.Unlock()
+
+ s.wg.Wait()
+
+ s.setInMode(s.oimode)
+ s.setOutMode(s.oomode)
+ s.setBufferSize(int(s.oscreen.size.x), int(s.oscreen.size.y))
+ s.clearScreen(StyleDefault, false)
+ s.setCursorPos(0, 0, false)
+ procSetConsoleTextAttribute.Call(
+ uintptr(s.out),
+ uintptr(s.mapStyle(StyleDefault)))
+}
+
+func (s *cScreen) engage() error {
+ s.Lock()
+ defer s.Unlock()
+ if s.stopQ != nil {
+ return errors.New("already engaged")
+ }
+ s.stopQ = make(chan struct{})
+ cf, _, e := procCreateEvent.Call(
+ uintptr(0),
+ uintptr(1),
+ uintptr(0),
+ uintptr(0))
+ if cf == uintptr(0) {
+ return e
+ }
+ s.cancelflag = syscall.Handle(cf)
+ s.enableMouse(s.mouseEnabled)
+
+ if s.vten {
+ s.setOutMode(modeVtOutput | modeNoAutoNL | modeCookedOut)
+ } else {
+ s.setOutMode(0)
+ }
+
+ s.clearScreen(s.style, s.vten)
+ s.hideCursor()
+
+ s.cells.Invalidate()
+ s.hideCursor()
+ s.resize()
+ s.draw()
+ s.doCursor()
+
+ s.wg.Add(1)
+ go s.scanInput(s.stopQ)
+ return nil
+}
+
func (s *cScreen) PostEventWait(ev Event) {
s.evch <- ev
}
@@ -367,7 +436,7 @@ func (s *cScreen) doCursor() {
if x < 0 || y < 0 || x >= s.w || y >= s.h {
s.hideCursor()
} else {
- s.setCursorPos(x, y)
+ s.setCursorPos(x, y, s.vten)
s.showCursor()
}
}
@@ -691,10 +760,15 @@ func (s *cScreen) getConsoleInput() error {
return nil
}
-func (s *cScreen) scanInput() {
+func (s *cScreen) scanInput(stopQ chan struct{}) {
+ defer s.wg.Done()
for {
+ select {
+ case <-stopQ:
+ return
+ default:
+ }
if e := s.getConsoleInput(); e != nil {
- close(s.scandone)
return
}
}
@@ -843,7 +917,7 @@ func (s *cScreen) writeString(x, y int, style Style, ch []uint16) {
if len(ch) == 0 {
return
}
- s.setCursorPos(x, y)
+ s.setCursorPos(x, y, s.vten)
if s.vten {
s.sendVtStyle(style)
@@ -859,7 +933,7 @@ func (s *cScreen) draw() {
// allocate a scratch line bit enough for no combining chars.
// if you have combining characters, you may pay for extra allocs.
if s.clear {
- s.clearScreen(s.style)
+ s.clearScreen(s.style, s.vten)
s.clear = false
s.cells.Invalidate()
}
@@ -965,8 +1039,8 @@ func (s *cScreen) setCursorInfo(info *cursorInfo) {
}
-func (s *cScreen) setCursorPos(x, y int) {
- if s.vten {
+func (s *cScreen) setCursorPos(x, y int, vtEnable bool) {
+ if vtEnable {
// Note that the string is Y first. Origin is 1,1.
s.emitVtString(fmt.Sprintf(vtCursorPos, y+1, x+1))
} else {
@@ -1028,15 +1102,15 @@ func (s *cScreen) Fill(r rune, style Style) {
s.Unlock()
}
-func (s *cScreen) clearScreen(style Style) {
- if s.vten {
+func (s *cScreen) clearScreen(style Style, vtEnable bool) {
+ if vtEnable {
s.sendVtStyle(style)
row := strings.Repeat(" ", s.w)
for y := 0; y < s.h; y++ {
- s.setCursorPos(0, y)
+ s.setCursorPos(0, y, vtEnable)
s.emitVtString(row)
}
- s.setCursorPos(0, 0)
+ s.setCursorPos(0, 0, vtEnable)
} else {
pos := coord{0, 0}
@@ -1185,3 +1259,12 @@ func (s *cScreen) Beep() error {
}
return nil
}
+
+func (s *cScreen) Suspend() error {
+ s.disengage()
+ return nil
+}
+
+func (s *cScreen) Resume() error {
+ return s.engage()
+}
diff --git a/vendor/github.com/gdamore/tcell/v2/go.mod b/vendor/github.com/gdamore/tcell/v2/go.mod
index f1829ae54..af97fa00b 100644
--- a/vendor/github.com/gdamore/tcell/v2/go.mod
+++ b/vendor/github.com/gdamore/tcell/v2/go.mod
@@ -5,7 +5,8 @@ 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.7
- golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756
+ github.com/mattn/go-runewidth v0.0.10
+ 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
)
diff --git a/vendor/github.com/gdamore/tcell/v2/go.sum b/vendor/github.com/gdamore/tcell/v2/go.sum
index 9f8691fb9..54d4bee63 100644
--- a/vendor/github.com/gdamore/tcell/v2/go.sum
+++ b/vendor/github.com/gdamore/tcell/v2/go.sum
@@ -2,9 +2,15 @@ github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdk
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.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54=
-github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
+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=
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756 h1:9nuHUbU8dRnRRfj9KjWUVrJeoexdbeMjttk6Oh1rD10=
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+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=
diff --git a/vendor/github.com/gdamore/tcell/v2/nonblock_bsd.go b/vendor/github.com/gdamore/tcell/v2/nonblock_bsd.go
new file mode 100644
index 000000000..df8fc0547
--- /dev/null
+++ b/vendor/github.com/gdamore/tcell/v2/nonblock_bsd.go
@@ -0,0 +1,50 @@
+// Copyright 2021 The TCell Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use file except in compliance with the License.
+// You may obtain a copy of the license at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build darwin dragonfly freebsd netbsd openbsd
+
+package tcell
+
+import (
+ "os"
+ "syscall"
+
+ "golang.org/x/sys/unix"
+)
+
+// BSD systems use TIOC style ioctls.
+
+// nonBlocking changes VMIN to 0, and VTIME to 1. This basically ensures that
+// we can wake up the input loop. We only want to do this if we are going to interrupt
+// that loop. Normally we use VMIN 1 and VTIME 0, which ensures we pick up bytes when
+// they come but don't spin burning cycles.
+func (t *tScreen) nonBlocking(on bool) {
+ fd := int(os.Stdin.Fd())
+ tio, err := unix.IoctlGetTermios(fd, unix.TIOCGETA)
+ if err != nil {
+ return
+ }
+ if on {
+ tio.Cc[unix.VMIN] = 0
+ tio.Cc[unix.VTIME] = 0
+ } else {
+ // block for any output
+ tio.Cc[unix.VTIME] = 0
+ tio.Cc[unix.VMIN] = 1
+ }
+
+ _ = syscall.SetNonblock(fd, on)
+ // We want to set this *right now*.
+ _ = unix.IoctlSetTermios(fd, unix.TIOCSETA, tio)
+}
diff --git a/vendor/github.com/gdamore/tcell/v2/nonblock_stub.go b/vendor/github.com/gdamore/tcell/v2/nonblock_stub.go
new file mode 100644
index 000000000..35758c33e
--- /dev/null
+++ b/vendor/github.com/gdamore/tcell/v2/nonblock_stub.go
@@ -0,0 +1,21 @@
+// Copyright 2021 The TCell Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use file except in compliance with the License.
+// You may obtain a copy of the license at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build plan9 windows js
+
+package tcell
+
+func (t *tScreen) nonBlocking(on bool) error {
+ return nil
+} \ No newline at end of file
diff --git a/vendor/github.com/gdamore/tcell/v2/nonblock_unix.go b/vendor/github.com/gdamore/tcell/v2/nonblock_unix.go
new file mode 100644
index 000000000..c4c374cc9
--- /dev/null
+++ b/vendor/github.com/gdamore/tcell/v2/nonblock_unix.go
@@ -0,0 +1,52 @@
+// Copyright 2021 The TCell Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use file except in compliance with the License.
+// You may obtain a copy of the license at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build linux aix zos solaris
+
+package tcell
+
+import (
+ "os"
+ "syscall"
+
+ "golang.org/x/sys/unix"
+)
+
+// NB: We might someday wish to move Windows to this model. However,
+// that would probably mean sacrificing some of the richer key reporting
+// that we can obtain with the console API present on Windows.
+
+// nonBlocking changes VMIN to 0, and VTIME to 1. This basically ensures that
+// we can wake up the input loop. We only want to do this if we are going to interrupt
+// that loop. Normally we use VMIN 1 and VTIME 0, which ensures we pick up bytes when
+// they come but don't spin burning cycles.
+func (t *tScreen) nonBlocking(on bool) {
+ fd := int(os.Stdin.Fd())
+ tio, err := unix.IoctlGetTermios(fd, unix.TCGETS)
+ if err != nil {
+ return
+ }
+ if on {
+ tio.Cc[unix.VMIN] = 0
+ tio.Cc[unix.VTIME] = 0
+ } else {
+ // block for any output
+ tio.Cc[unix.VTIME] = 0
+ tio.Cc[unix.VMIN] = 1
+ }
+
+ _ = syscall.SetNonblock(fd, on)
+ // We want to set this *right now*.
+ _ = unix.IoctlSetTermios(fd, unix.TCSETS, tio)
+}
diff --git a/vendor/github.com/gdamore/tcell/v2/screen.go b/vendor/github.com/gdamore/tcell/v2/screen.go
index a3c9e467e..37d7894dc 100644
--- a/vendor/github.com/gdamore/tcell/v2/screen.go
+++ b/vendor/github.com/gdamore/tcell/v2/screen.go
@@ -1,4 +1,4 @@
-// Copyright 2019 The TCell Authors
+// Copyright 2021 The TCell Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License.
@@ -16,7 +16,7 @@ package tcell
// Screen represents the physical (or emulated) screen.
// This can be a terminal window or a physical console. Platforms implement
-// this differerently.
+// this differently.
type Screen interface {
// Init initializes the screen for use.
Init() error
@@ -88,6 +88,9 @@ type Screen interface {
// is dropped, and ErrEventQFull is returned.
PostEvent(ev Event) error
+ // Deprecated: PostEventWait is unsafe, and will be removed
+ // in the future.
+ //
// PostEventWait is like PostEvent, but if the queue is full, it
// blocks until there is space in the queue, making delivery
// reliable. However, it is VERY important that this function
@@ -99,7 +102,9 @@ type Screen interface {
PostEventWait(ev Event)
// EnableMouse enables the mouse. (If your terminal supports it.)
- EnableMouse()
+ // If no flags are specified, then all events are reported, if the
+ // terminal supports them.
+ EnableMouse(...MouseFlags)
// DisableMouse disables the mouse.
DisableMouse()
@@ -200,6 +205,14 @@ type Screen interface {
// runes) is always true.
HasKey(Key) bool
+ // Suspend pauses input and output processing. It also restores the
+ // terminal settings to what they were when the application started.
+ // This can be used to, for example, run a sub-shell.
+ Suspend() error
+
+ // Resume resumes after Suspend().
+ Resume() error
+
// Beep attempts to sound an OS-dependent audible alert and returns an error
// when unsuccessful.
Beep() error
@@ -217,3 +230,13 @@ func NewScreen() (Screen, error) {
return nil, e
}
}
+
+// MouseFlags are options to modify the handling of mouse events.
+// Actual events can be or'd together.
+type MouseFlags int
+
+const (
+ MouseButtonEvents = MouseFlags(1) // Click events only
+ MouseDragEvents = MouseFlags(2) // Click-drag events (includes button events)
+ MouseMotionEvents = MouseFlags(4) // All mouse events (includes click and drag events)
+)
diff --git a/vendor/github.com/gdamore/tcell/v2/simulation.go b/vendor/github.com/gdamore/tcell/v2/simulation.go
index 211a21f01..7cb720cb5 100644
--- a/vendor/github.com/gdamore/tcell/v2/simulation.go
+++ b/vendor/github.com/gdamore/tcell/v2/simulation.go
@@ -1,4 +1,4 @@
-// Copyright 2020 The TCell Authors
+// Copyright 2021 The TCell Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License.
@@ -314,7 +314,7 @@ func (s *simscreen) draw() {
s.showCursor()
}
-func (s *simscreen) EnableMouse() {
+func (s *simscreen) EnableMouse(...MouseFlags) {
s.mouse = true
}
@@ -520,3 +520,11 @@ func (s *simscreen) HasKey(Key) bool {
func (s *simscreen) Beep() error {
return nil
}
+
+func (s *simscreen) Suspend() error {
+ return nil
+}
+
+func (s *simscreen) Resume() error {
+ return nil
+} \ No newline at end of file
diff --git a/vendor/github.com/gdamore/tcell/v2/terminfo/a/alacritty/term.go b/vendor/github.com/gdamore/tcell/v2/terminfo/a/alacritty/term.go
index 7257c65ec..e312fc48e 100644
--- a/vendor/github.com/gdamore/tcell/v2/terminfo/a/alacritty/term.go
+++ b/vendor/github.com/gdamore/tcell/v2/terminfo/a/alacritty/term.go
@@ -36,7 +36,6 @@ func init() {
ExitAcs: "\x1b(B",
StrikeThrough:"\x1b[9m",
Mouse: "\x1b[<",
- MouseMode: "\x1b[?1006;1000%?%p1%{1}%=%th%el%;",
SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b",
CursorUp1: "\x1b[A",
diff --git a/vendor/github.com/gdamore/tcell/v2/terminfo/dynamic/dynamic.go b/vendor/github.com/gdamore/tcell/v2/terminfo/dynamic/dynamic.go
index db253ca04..08ff24842 100644
--- a/vendor/github.com/gdamore/tcell/v2/terminfo/dynamic/dynamic.go
+++ b/vendor/github.com/gdamore/tcell/v2/terminfo/dynamic/dynamic.go
@@ -1,4 +1,4 @@
-// Copyright 2020 The TCell Authors
+// Copyright 2021 The TCell Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License.
@@ -394,26 +394,6 @@ func LoadTerminfo(name string) (*terminfo.Terminfo, string, error) {
t.SetFg = "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m"
}
- // If the kmous entry is present, then we need to record the
- // the codes to enter and exit mouse mode. Sadly, this is not
- // part of the terminfo databases anywhere that I've found, but
- // is an extension. The escapedape codes are documented in the XTerm
- // manual, and all terminals that have kmous are expected to
- // use these same codes, unless explicitly configured otherwise
- // vi XM. Note that in any event, we only known how to parse either
- // x11 or SGR mouse events -- if your terminal doesn't support one
- // of these two forms, you maybe out of luck.
- t.MouseMode = tc.getstr("XM")
- if t.Mouse != "" && t.MouseMode == "" {
- // we anticipate that all xterm mouse tracking compatible
- // terminals understand mouse tracking (1000), but we hope
- // that those that don't understand any-event tracking (1003)
- // will at least ignore it. Likewise we hope that terminals
- // that don't understand SGR reporting (1006) just ignore it.
- t.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"
- }
-
// We only support colors in ANSI 8 or 256 color mode.
if t.Colors < 8 || t.SetFg == "" {
t.Colors = 0
diff --git a/vendor/github.com/gdamore/tcell/v2/terminfo/g/gnome/term.go b/vendor/github.com/gdamore/tcell/v2/terminfo/g/gnome/term.go
index 1e976c74b..3675b8e20 100644
--- a/