mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-15 10:12:06 +03:00
vendor: update github.com/awesome-gocui/gocui dependencies
This commit is contained in:
parent
e4b30ee75c
commit
17b4329973
1
Gopkg.lock
generated
1
Gopkg.lock
generated
@ -498,6 +498,7 @@
|
|||||||
"github.com/go-errors/errors",
|
"github.com/go-errors/errors",
|
||||||
"github.com/gorilla/mux",
|
"github.com/gorilla/mux",
|
||||||
"github.com/icrowley/fake",
|
"github.com/icrowley/fake",
|
||||||
|
"github.com/mattn/go-isatty",
|
||||||
"github.com/phayes/freeport",
|
"github.com/phayes/freeport",
|
||||||
"github.com/pkg/errors",
|
"github.com/pkg/errors",
|
||||||
"github.com/shurcooL/githubv4",
|
"github.com/shurcooL/githubv4",
|
||||||
|
58
vendor/github.com/awesome-gocui/gocui/escape.go
generated
vendored
58
vendor/github.com/awesome-gocui/gocui/escape.go
generated
vendored
@ -5,8 +5,9 @@
|
|||||||
package gocui
|
package gocui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-errors/errors"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/go-errors/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
type escapeInterpreter struct {
|
type escapeInterpreter struct {
|
||||||
@ -17,13 +18,22 @@ type escapeInterpreter struct {
|
|||||||
mode OutputMode
|
mode OutputMode
|
||||||
}
|
}
|
||||||
|
|
||||||
type escapeState int
|
type (
|
||||||
|
escapeState int
|
||||||
|
fontEffect int
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
stateNone escapeState = iota
|
stateNone escapeState = iota
|
||||||
stateEscape
|
stateEscape
|
||||||
stateCSI
|
stateCSI
|
||||||
stateParams
|
stateParams
|
||||||
|
|
||||||
|
bold fontEffect = 1
|
||||||
|
underline fontEffect = 4
|
||||||
|
reverse fontEffect = 7
|
||||||
|
setForegroundColor fontEffect = 38
|
||||||
|
setBackgroundColor fontEffect = 48
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -191,39 +201,59 @@ func (ei *escapeInterpreter) output256() error {
|
|||||||
return ei.outputNormal()
|
return ei.outputNormal()
|
||||||
}
|
}
|
||||||
|
|
||||||
fgbg, err := strconv.Atoi(ei.csiParam[0])
|
for _, param := range splitFgBg(ei.csiParam) {
|
||||||
|
fgbg, err := strconv.Atoi(param[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errCSIParseError
|
return errCSIParseError
|
||||||
}
|
}
|
||||||
color, err := strconv.Atoi(ei.csiParam[2])
|
color, err := strconv.Atoi(param[2])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errCSIParseError
|
return errCSIParseError
|
||||||
}
|
}
|
||||||
|
|
||||||
switch fgbg {
|
switch fontEffect(fgbg) {
|
||||||
case 38:
|
case setForegroundColor:
|
||||||
ei.curFgColor = Attribute(color + 1)
|
ei.curFgColor = Attribute(color + 1)
|
||||||
|
|
||||||
for _, param := range ei.csiParam[3:] {
|
for _, s := range param[3:] {
|
||||||
p, err := strconv.Atoi(param)
|
p, err := strconv.Atoi(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errCSIParseError
|
return errCSIParseError
|
||||||
}
|
}
|
||||||
|
|
||||||
switch {
|
switch fontEffect(p) {
|
||||||
case p == 1:
|
case bold:
|
||||||
ei.curFgColor |= AttrBold
|
ei.curFgColor |= AttrBold
|
||||||
case p == 4:
|
case underline:
|
||||||
ei.curFgColor |= AttrUnderline
|
ei.curFgColor |= AttrUnderline
|
||||||
case p == 7:
|
case reverse:
|
||||||
ei.curFgColor |= AttrReverse
|
ei.curFgColor |= AttrReverse
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case 48:
|
case setBackgroundColor:
|
||||||
ei.curBgColor = Attribute(color + 1)
|
ei.curBgColor = Attribute(color + 1)
|
||||||
default:
|
default:
|
||||||
return errCSIParseError
|
return errCSIParseError
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func splitFgBg(params []string) [][]string {
|
||||||
|
var out [][]string
|
||||||
|
var current []string
|
||||||
|
for _, p := range params {
|
||||||
|
if len(current) == 3 && (p == "48" || p == "38") {
|
||||||
|
out = append(out, current)
|
||||||
|
current = []string{}
|
||||||
|
}
|
||||||
|
current = append(current, p)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(current) > 0 {
|
||||||
|
out = append(out, current)
|
||||||
|
}
|
||||||
|
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user