summaryrefslogtreecommitdiffstats
path: root/vendor
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-01-12 13:55:19 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-01-12 14:01:45 +1100
commit8e7f278094e70b54d3d8e385bd97500858c0e560 (patch)
treedb145e3da5ddd99ca13a8690c7944a9fc27f77f7 /vendor
parent83a895a46316a0e29d7ee7adabe76719cc773d63 (diff)
use mutexes on escape code
Diffstat (limited to 'vendor')
-rw-r--r--vendor/github.com/jesseduffield/gocui/escape.go17
-rw-r--r--vendor/modules.txt2
2 files changed, 17 insertions, 2 deletions
diff --git a/vendor/github.com/jesseduffield/gocui/escape.go b/vendor/github.com/jesseduffield/gocui/escape.go
index c88309b07..c09003e31 100644
--- a/vendor/github.com/jesseduffield/gocui/escape.go
+++ b/vendor/github.com/jesseduffield/gocui/escape.go
@@ -5,8 +5,10 @@
package gocui
import (
- "github.com/go-errors/errors"
"strconv"
+ "sync"
+
+ "github.com/go-errors/errors"
)
type escapeInterpreter struct {
@@ -15,6 +17,7 @@ type escapeInterpreter struct {
csiParam []string
curFgColor, curBgColor Attribute
mode OutputMode
+ mutex sync.Mutex
}
type escapeState int
@@ -34,6 +37,9 @@ var (
// runes in case of error will output the non-parsed runes as a string.
func (ei *escapeInterpreter) runes() []rune {
+ ei.mutex.Lock()
+ defer ei.mutex.Unlock()
+
switch ei.state {
case stateNone:
return []rune{0x1b}
@@ -66,6 +72,9 @@ func newEscapeInterpreter(mode OutputMode) *escapeInterpreter {
// reset sets the escapeInterpreter in initial state.
func (ei *escapeInterpreter) reset() {
+ ei.mutex.Lock()
+ defer ei.mutex.Unlock()
+
ei.state = stateNone
ei.curFgColor = ColorDefault
ei.curBgColor = ColorDefault
@@ -76,6 +85,9 @@ func (ei *escapeInterpreter) reset() {
// of an escape sequence, and as such should not be printed verbatim. Otherwise,
// it's not an escape sequence.
func (ei *escapeInterpreter) parseOne(ch rune) (isEscape bool, err error) {
+ ei.mutex.Lock()
+ defer ei.mutex.Unlock()
+
// Sanity checks
if len(ei.csiParam) > 20 {
return false, errCSITooLong
@@ -179,6 +191,9 @@ func (ei *escapeInterpreter) outputNormal() error {
// 0x11 - 0xe8: 216 different colors
// 0xe9 - 0x1ff: 24 different shades of grey
func (ei *escapeInterpreter) output256() error {
+ ei.mutex.Lock()
+ defer ei.mutex.Unlock()
+
if len(ei.csiParam) < 3 {
return ei.outputNormal()
}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 9f0a28176..80c8a96db 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -32,7 +32,7 @@ github.com/hashicorp/hcl/json/token
github.com/integrii/flaggy
# github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99
github.com/jbenet/go-context/io
-# github.com/jesseduffield/gocui v0.3.1-0.20200112022728-874f1f64ada7
+# github.com/jesseduffield/gocui v0.3.1-0.20200112025325-6c933915c351
github.com/jesseduffield/gocui
# github.com/jesseduffield/pty v1.2.1
github.com/jesseduffield/pty