Update dependencies

This commit is contained in:
Tulir Asokan 2018-05-25 22:44:12 +03:00
parent a76ce88a30
commit 7b8229dab1
41 changed files with 1232 additions and 1319 deletions

6
Gopkg.lock generated
View File

@ -23,7 +23,7 @@
branch = "master" branch = "master"
name = "github.com/lucasb-eyer/go-colorful" name = "github.com/lucasb-eyer/go-colorful"
packages = ["."] packages = ["."]
revision = "fa0f842f26263fb2ace6d6118309c8481e029fc1" revision = "8abd3beca3a7f5039809449d6013a0254ac22bb1"
[[projects]] [[projects]]
name = "github.com/mattn/go-runewidth" name = "github.com/mattn/go-runewidth"
@ -88,7 +88,7 @@
"html", "html",
"html/atom" "html/atom"
] ]
revision = "9ef9f5bb98a1fdc41f8cf6c250a4404b4085e389" revision = "dfa909b99c79129e1100513e5cd36307665e5723"
[[projects]] [[projects]]
name = "golang.org/x/text" name = "golang.org/x/text"
@ -133,7 +133,7 @@
".", ".",
"terminfo" "terminfo"
] ]
revision = "e03df2c40d0ab5487a6b3c06a228755cdfec1c46" revision = "9dc7ec911605bc6db5c96f502e6a80494afe4e1b"
[[projects]] [[projects]]
branch = "master" branch = "master"

View File

@ -18,7 +18,8 @@ func FastWarmColor() Color {
// This is slower than FastWarmColor but will likely give you colors which have // This is slower than FastWarmColor but will likely give you colors which have
// the same "warmness" if you run it many times. // the same "warmness" if you run it many times.
func WarmColor() (c Color) { func WarmColor() (c Color) {
for c = randomWarm() ; !c.IsValid() ; c = randomWarm() {} for c = randomWarm(); !c.IsValid(); c = randomWarm() {
}
return return
} }
@ -41,7 +42,8 @@ func FastHappyColor() Color {
// This is slower than FastHappyColor but will likely give you colors which // This is slower than FastHappyColor but will likely give you colors which
// have the same "brightness" if you run it many times. // have the same "brightness" if you run it many times.
func HappyColor() (c Color) { func HappyColor() (c Color) {
for c = randomPimp() ; !c.IsValid() ; c = randomPimp() {} for c = randomPimp(); !c.IsValid(); c = randomPimp() {
}
return return
} }
@ -51,4 +53,3 @@ func randomPimp() Color {
0.5+rand.Float64()*0.3, 0.5+rand.Float64()*0.3,
0.5+rand.Float64()*0.3) 0.5+rand.Float64()*0.3)
} }

View File

@ -3,8 +3,8 @@ package colorful
import ( import (
"fmt" "fmt"
"math"
"image/color" "image/color"
"math"
) )
// A color is stored internally using sRGB (standard RGB) values in the range 0-1 // A color is stored internally using sRGB (standard RGB) values in the range 0-1
@ -72,11 +72,11 @@ func (c Color) Clamped() Color {
} }
func sq(v float64) float64 { func sq(v float64) float64 {
return v * v; return v * v
} }
func cub(v float64) float64 { func cub(v float64) float64 {
return v * v * v; return v * v * v
} }
// DistanceRgb computes the distance between two colors in RGB space. // DistanceRgb computes the distance between two colors in RGB space.
@ -107,7 +107,6 @@ func interp_angle(a0, a1, t float64) float64 {
return math.Mod(a0+t*delta+360.0, 360.0) return math.Mod(a0+t*delta+360.0, 360.0)
} }
/// HSV /// /// HSV ///
/////////// ///////////
// From http://en.wikipedia.org/wiki/HSL_and_HSV // From http://en.wikipedia.org/wiki/HSL_and_HSV
@ -126,11 +125,19 @@ func (col Color) Hsv() (h, s, v float64) {
h = 0.0 // We use 0 instead of undefined as in wp. h = 0.0 // We use 0 instead of undefined as in wp.
if min != v { if min != v {
if v == col.R { h = math.Mod((col.G - col.B) / C, 6.0) } if v == col.R {
if v == col.G { h = (col.B - col.R) / C + 2.0 } h = math.Mod((col.G-col.B)/C, 6.0)
if v == col.B { h = (col.R - col.G) / C + 4.0 } }
if v == col.G {
h = (col.B-col.R)/C + 2.0
}
if v == col.B {
h = (col.R-col.G)/C + 4.0
}
h *= 60.0 h *= 60.0
if h < 0.0 { h += 360.0 } if h < 0.0 {
h += 360.0
}
} }
return return
} }
@ -141,16 +148,28 @@ func Hsv(H, S, V float64) Color {
C := V * S C := V * S
X := C * (1.0 - math.Abs(math.Mod(Hp, 2.0)-1.0)) X := C * (1.0 - math.Abs(math.Mod(Hp, 2.0)-1.0))
m := V-C; m := V - C
r, g, b := 0.0, 0.0, 0.0 r, g, b := 0.0, 0.0, 0.0
switch { switch {
case 0.0 <= Hp && Hp < 1.0: r = C; g = X case 0.0 <= Hp && Hp < 1.0:
case 1.0 <= Hp && Hp < 2.0: r = X; g = C r = C
case 2.0 <= Hp && Hp < 3.0: g = C; b = X g = X
case 3.0 <= Hp && Hp < 4.0: g = X; b = C case 1.0 <= Hp && Hp < 2.0:
case 4.0 <= Hp && Hp < 5.0: r = X; b = C r = X
case 5.0 <= Hp && Hp < 6.0: r = C; b = X g = C
case 2.0 <= Hp && Hp < 3.0:
g = C
b = X
case 3.0 <= Hp && Hp < 4.0:
g = X
b = C
case 4.0 <= Hp && Hp < 5.0:
r = X
b = C
case 5.0 <= Hp && Hp < 6.0:
r = C
b = X
} }
return Color{m + r, m + g, m + b} return Color{m + r, m + g, m + b}
@ -229,22 +248,22 @@ func Hsl(h, s, l float64) Color {
tb = h - 1.0/3.0 tb = h - 1.0/3.0
if tr < 0 { if tr < 0 {
tr += 1 tr++
} }
if tr > 1 { if tr > 1 {
tr -= 1 tr--
} }
if tg < 0 { if tg < 0 {
tg += 1 tg++
} }
if tg > 1 { if tg > 1 {
tg -= 1 tg--
} }
if tb < 0 { if tb < 0 {
tb += 1 tb++
} }
if tb > 1 { if tb > 1 {
tb -= 1 tb--
} }
// Red // Red

View File

@ -23,4 +23,3 @@ func HappyPalette(colorsCount int) ([]Color, error) {
} }
return SoftPaletteEx(colorsCount, SoftPaletteSettings{pimpy, 50, true}) return SoftPaletteEx(colorsCount, SoftPaletteSettings{pimpy, 50, true})
} }

View File

@ -163,6 +163,7 @@ func in(haystack []lab_t, upto int, needle lab_t) bool {
} }
const LAB_DELTA = 1e-6 const LAB_DELTA = 1e-6
func lab_eq(lab1, lab2 lab_t) bool { func lab_eq(lab1, lab2 lab_t) bool {
return math.Abs(lab1.L-lab2.L) < LAB_DELTA && return math.Abs(lab1.L-lab2.L) < LAB_DELTA &&
math.Abs(lab1.A-lab2.A) < LAB_DELTA && math.Abs(lab1.A-lab2.A) < LAB_DELTA &&
@ -182,4 +183,3 @@ func labs2cols(labs []lab_t) (cols []Color) {
} }
return cols return cols
} }

View File

@ -23,4 +23,3 @@ func WarmPalette(colorsCount int) ([]Color, error) {
} }
return SoftPaletteEx(colorsCount, SoftPaletteSettings{warmy, 50, true}) return SoftPaletteEx(colorsCount, SoftPaletteSettings{warmy, 50, true})
} }

View File

@ -48,12 +48,13 @@ func (cb *CellBuffer) SetContent(x int, y int,
if x >= 0 && y >= 0 && x < cb.w && y < cb.h { if x >= 0 && y >= 0 && x < cb.w && y < cb.h {
c := &cb.cells[(y*cb.w)+x] c := &cb.cells[(y*cb.w)+x]
c.currComb = append([]rune{}, combc...)
i := 0 i := 0
for i < len(combc) { for i < len(c.currComb) {
r := combc[i] r := c.currComb[i]
if runewidth.RuneWidth(r) != 0 { if runewidth.RuneWidth(r) != 0 {
// not a combining character, yank it // not a combining character, yank it
combc = append(combc[:i-1], combc[i+1:]...) c.currComb = append(c.currComb[:i-1], c.currComb[i+1:]...)
continue continue
} }
i++ i++
@ -63,7 +64,6 @@ func (cb *CellBuffer) SetContent(x int, y int,
c.width = runewidth.RuneWidth(mainc) c.width = runewidth.RuneWidth(mainc)
} }
c.currMain = mainc c.currMain = mainc
c.currComb = combc
c.currStyle = style c.currStyle = style
} }
} }

View File

@ -185,7 +185,7 @@ func (s *cScreen) CharacterSet() string {
} }
func (s *cScreen) EnableMouse() { func (s *cScreen) EnableMouse() {
s.setInMode(modeResizeEn | modeMouseEn) s.setInMode(modeResizeEn | modeMouseEn | modeExtndFlg)
} }
func (s *cScreen) DisableMouse() { func (s *cScreen) DisableMouse() {
@ -570,8 +570,14 @@ func (s *cScreen) getConsoleInput() error {
if krec.ch != 0 { if krec.ch != 0 {
// synthesized key code // synthesized key code
for krec.repeat > 0 { for krec.repeat > 0 {
// convert shift+tab to backtab
if mod2mask(krec.mod) == ModShift && krec.ch == vkTab {
s.PostEvent(NewEventKey(KeyBacktab, 0,
ModNone))
} else {
s.PostEvent(NewEventKey(KeyRune, rune(krec.ch), s.PostEvent(NewEventKey(KeyRune, rune(krec.ch),
mod2mask(krec.mod))) mod2mask(krec.mod)))
}
krec.repeat-- krec.repeat--
} }
return nil return nil
@ -925,6 +931,7 @@ func (s *cScreen) clearScreen(style Style) {
} }
const ( const (
modeExtndFlg uint32 = 0x0080
modeMouseEn uint32 = 0x0010 modeMouseEn uint32 = 0x0010
modeResizeEn uint32 = 0x0008 modeResizeEn uint32 = 0x0008
modeWrapEOL uint32 = 0x0002 modeWrapEOL uint32 = 0x0002

8
vendor/maunium.net/go/tcell/terminfo/README.md generated vendored Normal file
View File

@ -0,0 +1,8 @@
To run the database:
./mkinfo -all
You can also generate a single entry:
./mkinfo -db <term>

View File

@ -1,189 +0,0 @@
#!/bin/bash
# Copyright 2017 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.
#
# When called with no arguments, this shell script builds the Go database,
# which is somewhat minimal for size reasons (it only contains the most
# commonly used entries), and then builds the complete JSON database.
#
# To limit the action to only building one or more terminals, specify them
# on the command line:
#
# ./mkdatabase xterm
#
# The script will also find and update or add any terminal "aliases".
# It does not remove any old entries.
#
# To add to the set of terminals that we compile into the Go database,
# add their names to the models.txt file.
#
# This script is not very efficient, but there isn't really a better way
# without writing code to decode the terminfo binary format directly.
# Its not worth worrying about.
# This script also requires bash, although ksh93 should work as well, because
# we use arrays, which are not specified in POSIX.
export LANG=C
export LC_CTYPE=C
progress()
{
typeset -i num=$1
typeset -i tot=$2
typeset -i x
typeset back
typeset s
if (( tot < 1 ))
then
s=$(printf "[ %d ]" $num)
back="\b\b\b\b\b"
x=$num
while (( x >= 10 ))
do
back="${back}\b"
x=$(( x / 10 ))
done
else
x=$(( num * 100 / tot ))
s=$(printf "<%3d%%>" $x)
back="\b\b\b\b\b\b"
fi
printf "%s${back}" "$s"
}
ord()
{
printf "%02x" "'$1'"
}
goterms=( $(cat models.txt) )
args=( $* )
if (( ${#args[@]} == 0 ))
then
args=( $(toe -a | cut -f1) )
fi
printf "Scanning terminal definitions: "
i=0
aliases=()
models=()
for term in ${args[@]}
do
case "${term}" in
*-truecolor)
line="${term}|24-bit color"
;;
*)
line=$(infocmp $term | head -2 | tail -1)
if [[ -z "$line" ]]
then
echo "Cannot find terminfo for $term"
exit 1
fi
# take off the trailing comma
line=${line%,}
esac
# grab primary name
term=${line%%|*}
all+=( ${term} )
# should this be in our go terminals?
for model in ${goterms[@]}
do
if [[ "${model}" == "${term}" ]]
then
models+=( ${term} )
fi
done
# chop off primary name
line=${line#${term}}
line=${line#|}
# chop off description
line=${line%|*}
while [[ "$line" != "" ]]
do
a=${line%%|*}
aliases+=( ${a}=${term} )
line=${line#$a}
line=${line#|}
done
i=$(( i + 1 ))
progress $i ${#args[@]}
done
echo
# make sure we have mkinfo
printf "Building mkinfo: "
go build mkinfo.go
echo "done."
# Build all the go database files for the "interesting" terminals".
printf "Building Go database: "
i=0
for model in ${models[@]}
do
safe=$(echo $model | tr - _)
file=term_${safe}.go
./mkinfo -go $file $model
go fmt ${file} >/dev/null
i=$(( i + 1 ))
progress $i ${#models[@]}
done
echo
printf "Building JSON database: "
# The JSON files are located for each terminal in a file with the
# terminal name, in the following fashion "database/x/xterm.json
i=0
for model in ${all[@]}
do
letter=$(ord ${model:0:1})
dir=database/${letter}
file=${dir}/${model}.gz
mkdir -p ${dir}
./mkinfo -nofatal -quiet -gzip -json ${file} ${model}
i=$(( i + 1 ))
progress $i ${#all[@]}
done
echo
printf "Building JSON aliases: "
i=0
for model in ${aliases[@]}
do
canon=${model#*=}
model=${model%=*}
letter=$(ord ${model:0:1})
cletter=$(ord ${canon:0:1})
dir=database/${letter}
file=${dir}/${model}
if [[ -f database/${cletter}/${canon}.gz ]]
then
[[ -d ${dir} ]] || mkdir -p ${dir}
# Generally speaking the aliases are better uncompressed
./mkinfo -nofatal -quiet -json ${file} ${model}
fi
i=$(( i + 1 ))
progress $i ${#aliases[@]}
done
echo

View File

@ -1,6 +1,6 @@
// +build ignore // +build ignore
// Copyright 2017 The TCell Authors // Copyright 2018 The TCell Authors
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License. // you may not use file except in compliance with the License.
@ -22,6 +22,8 @@
// //
// mkinfo [-init] [-go file.go] [-json file.json] [-quiet] [-nofatal] [<term>...] // mkinfo [-init] [-go file.go] [-json file.json] [-quiet] [-nofatal] [<term>...]
// //
// -all scan terminfo to determine database entries to use
// -db generate database entries (database/*), implied for -all
// -gzip specifies output should be compressed (json only) // -gzip specifies output should be compressed (json only)
// -go specifies Go output into the named file. Use - for stdout. // -go specifies Go output into the named file. Use - for stdout.
// -json specifies JSON output in the named file. Use - for stdout // -json specifies JSON output in the named file. Use - for stdout
@ -31,8 +33,10 @@
package main package main
import ( import (
"bufio"
"bytes" "bytes"
"compress/gzip" "compress/gzip"
"crypto/sha1"
"encoding/json" "encoding/json"
"errors" "errors"
"flag" "flag"
@ -40,6 +44,7 @@ import (
"io" "io"
"os" "os"
"os/exec" "os/exec"
"path"
"regexp" "regexp"
"strconv" "strconv"
"strings" "strings"
@ -74,6 +79,8 @@ const (
ESC ESC
) )
var notaddressable = errors.New("terminal not cursor addressable")
func unescape(s string) string { func unescape(s string) string {
// Various escapes are in \x format. Control codes are // Various escapes are in \x format. Control codes are
// encoded as ^M (carat followed by ASCII equivalent). // encoded as ^M (carat followed by ASCII equivalent).
@ -131,6 +138,25 @@ func unescape(s string) string {
return (buf.String()) return (buf.String())
} }
func getallterms() ([]string, error) {
out := []string{}
cmd := exec.Command("toe", "-a")
output := &bytes.Buffer{}
cmd.Stdout = output
err := cmd.Run()
if err != nil {
return nil, err
}
lines := strings.Split(output.String(), "\n")
for _, l := range lines {
fields := strings.Fields(l)
if len(fields) > 0 {
out = append(out, fields[0])
}
}
return out, nil
}
func (tc *termcap) setupterm(name string) error { func (tc *termcap) setupterm(name string) error {
cmd := exec.Command("infocmp", "-1", name) cmd := exec.Command("infocmp", "-1", name)
output := &bytes.Buffer{} output := &bytes.Buffer{}
@ -183,7 +209,7 @@ func (tc *termcap) setupterm(name string) error {
if k := strings.SplitN(val, "=", 2); len(k) == 2 { if k := strings.SplitN(val, "=", 2); len(k) == 2 {
tc.strs[k[0]] = unescape(k[1]) tc.strs[k[0]] = unescape(k[1])
} else if k := strings.SplitN(val, "#", 2); len(k) == 2 { } else if k := strings.SplitN(val, "#", 2); len(k) == 2 {
if u, err := strconv.ParseUint(k[1], 10, 0); err != nil { if u, err := strconv.ParseUint(k[1], 0, 0); err != nil {
return (err) return (err)
} else { } else {
tc.nums[k[0]] = int(u) tc.nums[k[0]] = int(u)
@ -438,7 +464,7 @@ func getinfo(name string) (*terminfo.Terminfo, string, error) {
t.Colors = 0 t.Colors = 0
} }
if t.SetCursor == "" { if t.SetCursor == "" {
return nil, "", errors.New("terminal not cursor addressable") return nil, "", notaddressable
} }
// For padding, we lookup the pad char. If that isn't present, // For padding, we lookup the pad char. If that isn't present,
@ -684,13 +710,135 @@ func dotGoInfo(w io.Writer, t *terminfo.Terminfo, desc string) {
fmt.Fprintln(w, "}") fmt.Fprintln(w, "}")
} }
var packname = "terminfo"
func dotGoFile(fname string, term *terminfo.Terminfo, desc string, makeDir bool) error {
w := os.Stdout
var e error
if fname != "-" && fname != "" {
if makeDir {
dname := path.Dir(fname)
_ = os.Mkdir(dname, 0777)
}
if w, e = os.Create(fname); e != nil {
return e
}
}
dotGoHeader(w, packname)
dotGoInfo(w, term, desc)
dotGoTrailer(w)
if w != os.Stdout {
w.Close()
}
cmd := exec.Command("go", "fmt", fname)
cmd.Run()
return nil
}
func dotGzFile(fname string, term *terminfo.Terminfo, makeDir bool) error {
var w io.WriteCloser = os.Stdout
var e error
if fname != "-" && fname != "" {
if makeDir {
dname := path.Dir(fname)
_ = os.Mkdir(dname, 0777)
}
if w, e = os.Create(fname); e != nil {
return e
}
}
w = gzip.NewWriter(w)
js, e := json.Marshal(term)
fmt.Fprintln(w, string(js))
if w != os.Stdout {
w.Close()
}
return nil
}
func jsonFile(fname string, term *terminfo.Terminfo, makeDir bool) error {
w := os.Stdout
var e error
if fname != "-" && fname != "" {
if makeDir {
dname := path.Dir(fname)
_ = os.Mkdir(dname, 0777)
}
if w, e = os.Create(fname); e != nil {
return e
}
}
js, e := json.Marshal(term)
fmt.Fprintln(w, string(js))
if w != os.Stdout {
w.Close()
}
return nil
}
func dumpDatabase(terms map[string]*terminfo.Terminfo, descs map[string]string) {
// Load models .text
mfile, e := os.Open("models.txt")
models := make(map[string]bool)
if e != nil {
fmt.Fprintf(os.Stderr, "Failed reading models.txt: %v", e)
}
scanner := bufio.NewScanner(mfile)
for scanner.Scan() {
models[scanner.Text()] = true
}
for name, t := range terms {
// If this is one of our builtin models, generate the GO file
if models[name] {
desc := descs[name]
safename := strings.Replace(name, "-", "_", -1)
goname := fmt.Sprintf("term_%s.go", safename)
e = dotGoFile(goname, t, desc, true)
if e != nil {
fmt.Fprintf(os.Stderr, "Failed creating %s: %v", goname, e)
os.Exit(1)
}
continue
}
hash := fmt.Sprintf("%x", sha1.Sum([]byte(name)))
fname := fmt.Sprintf("%s.gz", hash[0:8])
fname = path.Join("database", hash[0:2], fname)
e = dotGzFile(fname, t, true)
if e != nil {
fmt.Fprintf(os.Stderr, "Failed creating %s: %v", fname, e)
os.Exit(1)
}
for _, a := range t.Aliases {
hash = fmt.Sprintf("%x", sha1.Sum([]byte(a)))
fname = path.Join("database", hash[0:2], hash[0:8])
e = jsonFile(fname, &terminfo.Terminfo{Name: t.Name}, true)
if e != nil {
fmt.Fprintf(os.Stderr, "Failed creating %s: %v", fname, e)
os.Exit(1)
}
}
}
}
func main() { func main() {
gofile := "" gofile := ""
jsonfile := "" jsonfile := ""
packname := "terminfo"
nofatal := false nofatal := false
quiet := false quiet := false
dogzip := false dogzip := false
all := false
db := false
flag.StringVar(&gofile, "go", "", "generate go source in named file") flag.StringVar(&gofile, "go", "", "generate go source in named file")
flag.StringVar(&jsonfile, "json", "", "generate json in named file") flag.StringVar(&jsonfile, "json", "", "generate json in named file")
@ -698,11 +846,21 @@ func main() {
flag.BoolVar(&nofatal, "nofatal", false, "errors are not fatal") flag.BoolVar(&nofatal, "nofatal", false, "errors are not fatal")
flag.BoolVar(&quiet, "quiet", false, "suppress error messages") flag.BoolVar(&quiet, "quiet", false, "suppress error messages")
flag.BoolVar(&dogzip, "gzip", false, "compress json output") flag.BoolVar(&dogzip, "gzip", false, "compress json output")
flag.BoolVar(&all, "all", false, "load all terminals from terminfo")
flag.BoolVar(&db, "db", false, "generate json db file in place")
flag.Parse() flag.Parse()
var e error var e error
js := []byte{}
args := flag.Args() args := flag.Args()
if all {
db = true // implied
allterms, e := getallterms()
if e != nil {
fmt.Fprintf(os.Stderr, "Failed: %v", e)
os.Exit(1)
}
args = append(args, allterms...)
}
if len(args) == 0 { if len(args) == 0 {
args = []string{os.Getenv("TERM")} args = []string{os.Getenv("TERM")}
} }
@ -712,6 +870,9 @@ func main() {
for _, term := range args { for _, term := range args {
if t, desc, e := getinfo(term); e != nil { if t, desc, e := getinfo(term); e != nil {
if all && e == notaddressable {
continue
}
if !quiet { if !quiet {
fmt.Fprintf(os.Stderr, fmt.Fprintf(os.Stderr,
"Failed loading %s: %v\n", term, e) "Failed loading %s: %v\n", term, e)
@ -729,53 +890,33 @@ func main() {
// No data. // No data.
os.Exit(0) os.Exit(0)
} }
if gofile != "" {
w := os.Stdout if db {
if gofile != "-" { dumpDatabase(tdata, descs)
if w, e = os.Create(gofile); e != nil { } else if gofile != "" {
fmt.Fprintf(os.Stderr, "Failed: %v", e)
os.Exit(1)
}
}
dotGoHeader(w, packname)
for term, t := range tdata { for term, t := range tdata {
if t.Name == term { if t.Name == term {
dotGoInfo(w, t, descs[term]) e = dotGoFile(gofile, t, descs[term], false)
}
}
dotGoTrailer(w)
if w != os.Stdout {
w.Close()
}
} else {
o := os.Stdout
if jsonfile != "-" && jsonfile != "" {
if o, e = os.Create(jsonfile); e != nil {
fmt.Fprintf(os.Stderr, "Failed: %v", e)
}
}
var w io.WriteCloser
w = o
if dogzip {
w = gzip.NewWriter(o)
}
for _, term := range args {
if t := tdata[term]; t != nil {
js, e = json.Marshal(t)
fmt.Fprintln(w, string(js))
}
// arguably if there is more than one term, this
// should be a javascript array, but that's not how
// we load it. We marshal objects one at a time from
// the file.
}
if e != nil { if e != nil {
fmt.Fprintf(os.Stderr, "Failed: %v", e) fmt.Fprintf(os.Stderr, "Failed %s: %v", gofile, e)
os.Exit(1) os.Exit(1)
} }
w.Close() }
if w != o { }
o.Close()
} else {
for _, t := range tdata {
if dogzip {
if e = dotGzFile(jsonfile, t, false); e != nil {
fmt.Fprintf(os.Stderr, "Failed %s: %v", gofile, e)
os.Exit(1)
}
} else {
if e = jsonFile(jsonfile, t, false); e != nil {
fmt.Fprintf(os.Stderr, "Failed %s: %v", gofile, e)
os.Exit(1)
}
}
} }
} }
} }

View File

@ -8,8 +8,6 @@ cygwin
d200 d200
d210 d210
dtterm dtterm
Eterm
Eterm-256color
eterm eterm
gnome gnome
gnome-256color gnome-256color

View File

@ -1,108 +0,0 @@
// Generated automatically. DO NOT HAND-EDIT.
package terminfo
func init() {
// Eterm with xterm-style color support (X Window System)
AddTerminfo(&Terminfo{
Name: "Eterm",
Aliases: []string{"Eterm-color"},
Columns: 80,
Lines: 24,
Colors: 8,
Bell: "\a",
Clear: "\x1b[H\x1b[2J",
EnterCA: "\x1b7\x1b[?47h",
ExitCA: "\x1b[2J\x1b[?47l\x1b8",
ShowCursor: "\x1b[?25h",
HideCursor: "\x1b[?25l",
AttrOff: "\x1b[m\x0f",
Underline: "\x1b[4m",
Bold: "\x1b[1m",
Italic: "\x1b[3m",
Strikethrough: "\x1b[9m",
Blink: "\x1b[5m",
Reverse: "\x1b[7m",
SetFg: "\x1b[3%p1%dm",
SetBg: "\x1b[4%p1%dm",
SetFgBg: "\x1b[3%p1%d;4%p2%dm",
PadChar: "\x00",
AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~",
EnterAcs: "\x0e",
ExitAcs: "\x0f",
EnableAcs: "\x1b)0",
Mouse: "\x1b[M",
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",
SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b",
CursorUp1: "\x1b[A",
KeyUp: "\x1b[A",
KeyDown: "\x1b[B",
KeyRight: "\x1b[C",
KeyLeft: "\x1b[D",
KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f",
KeyHome: "\x1b[7~",
KeyEnd: "\x1b[8~",
KeyPgUp: "\x1b[5~",
KeyPgDn: "\x1b[6~",
KeyF1: "\x1b[11~",
KeyF2: "\x1b[12~",
KeyF3: "\x1b[13~",
KeyF4: "\x1b[14~",
KeyF5: "\x1b[15~",
KeyF6: "\x1b[17~",
KeyF7: "\x1b[18~",
KeyF8: "\x1b[19~",
KeyF9: "\x1b[20~",
KeyF10: "\x1b[21~",
KeyF11: "\x1b[23~",
KeyF12: "\x1b[24~",
KeyF13: "\x1b[25~",
KeyF14: "\x1b[26~",
KeyF15: "\x1b[28~",
KeyF16: "\x1b[29~",
KeyF17: "\x1b[31~",
KeyF18: "\x1b[32~",
KeyF19: "\x1b[33~",
KeyF20: "\x1b[34~",
KeyF21: "\x1b[23$",
KeyF22: "\x1b[24$",
KeyF23: "\x1b[11^",
KeyF24: "\x1b[12^",
KeyF25: "\x1b[13^",
KeyF26: "\x1b[14^",
KeyF27: "\x1b[15^",
KeyF28: "\x1b[17^",
KeyF29: "\x1b[18^",
KeyF30: "\x1b[19^",
KeyF31: "\x1b[20^",
KeyF32: "\x1b[21^",
KeyF33: "\x1b[23^",
KeyF34: "\x1b[24^",
KeyF35: "\x1b[25^",
KeyF36: "\x1b[26^",
KeyF37: "\x1b[28^",
KeyF38: "\x1b[29^",
KeyF39: "\x1b[31^",
KeyF40: "\x1b[32^",
KeyF41: "\x1b[33^",
KeyF42: "\x1b[34^",
KeyF43: "\x1b[23@",
KeyF44: "\x1b[24@",
KeyHelp: "\x1b[28~",
KeyShfLeft: "\x1b[d",
KeyShfRight: "\x1b[c",
KeyShfUp: "\x1b[a",
KeyShfDown: "\x1b[b",
KeyCtrlLeft: "\x1b[Od",
KeyCtrlRight: "\x1b[Oc",
KeyCtrlUp: "\x1b[Oa",
KeyCtrlDown: "\x1b[Ob",
KeyShfHome: "\x1b[7$",
KeyShfEnd: "\x1b[8$",
KeyCtrlHome: "\x1b[7^",
KeyCtrlEnd: "\x1b[8^",
})
}

View File

@ -1,107 +0,0 @@
// Generated automatically. DO NOT HAND-EDIT.
package terminfo
func init() {
// Eterm with xterm 256-colors
AddTerminfo(&Terminfo{
Name: "Eterm-256color",
Columns: 80,
Lines: 24,
Colors: 256,
Bell: "\a",
Clear: "\x1b[H\x1b[2J",
EnterCA: "\x1b7\x1b[?47h",
ExitCA: "\x1b[2J\x1b[?47l\x1b8",
ShowCursor: "\x1b[?25h",
HideCursor: "\x1b[?25l",
AttrOff: "\x1b[m\x0f",
Underline: "\x1b[4m",
Bold: "\x1b[1m",
Italic: "\x1b[3m",
Strikethrough: "\x1b[9m",
Blink: "\x1b[5m",
Reverse: "\x1b[7m",
SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m",
SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m",
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",
PadChar: "\x00",
AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~",
EnterAcs: "\x0e",
ExitAcs: "\x0f",
EnableAcs: "\x1b)0",
Mouse: "\x1b[M",
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",
SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b",
CursorUp1: "\x1b[A",
KeyUp: "\x1b[A",
KeyDown: "\x1b[B",
KeyRight: "\x1b[C",
KeyLeft: "\x1b[D",
KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f",
KeyHome: "\x1b[7~",
KeyEnd: "\x1b[8~",
KeyPgUp: "\x1b[5~",
KeyPgDn: "\x1b[6~",
KeyF1: "\x1b[11~",
KeyF2: "\x1b[12~",
KeyF3: "\x1b[13~",
KeyF4: "\x1b[14~",
KeyF5: "\x1b[15~",
KeyF6: "\x1b[17~",
KeyF7: "\x1b[18~",
KeyF8: "\x1b[19~",
KeyF9: "\x1b[20~",
KeyF10: "\x1b[21~",
KeyF11: "\x1b[23~",
KeyF12: "\x1b[24~",
KeyF13: "\x1b[25~",
KeyF14: "\x1b[26~",
KeyF15: "\x1b[28~",
KeyF16: "\x1b[29~",
KeyF17: "\x1b[31~",
KeyF18: "\x1b[32~",
KeyF19: "\x1b[33~",
KeyF20: "\x1b[34~",
KeyF21: "\x1b[23$",
KeyF22: "\x1b[24$",
KeyF23: "\x1b[11^",
KeyF24: "\x1b[12^",
KeyF25: "\x1b[13^",
KeyF26: "\x1b[14^",
KeyF27: "\x1b[15^",
KeyF28: "\x1b[17^",
KeyF29: "\x1b[18^",
KeyF30: "\x1b[19^",
KeyF31: "\x1b[20^",
KeyF32: "\x1b[21^",
KeyF33: "\x1b[23^",
KeyF34: "\x1b[24^",
KeyF35: "\x1b[25^",
KeyF36: "\x1b[26^",
KeyF37: "\x1b[28^",
KeyF38: "\x1b[29^",
KeyF39: "\x1b[31^",
KeyF40: "\x1b[32^",
KeyF41: "\x1b[33^",
KeyF42: "\x1b[34^",
KeyF43: "\x1b[23@",
KeyF44: "\x1b[24@",
KeyHelp: "\x1b[28~",
KeyShfLeft: "\x1b[d",
KeyShfRight: "\x1b[c",
KeyShfUp: "\x1b[a",
KeyShfDown: "\x1b[b",
KeyCtrlLeft: "\x1b[Od",
KeyCtrlRight: "\x1b[Oc",
KeyCtrlUp: "\x1b[Oa",
KeyCtrlDown: "\x1b[Ob",
KeyShfHome: "\x1b[7$",
KeyShfEnd: "\x1b[8$",
KeyCtrlHome: "\x1b[7^",
KeyCtrlEnd: "\x1b[8^",
})
}

View File

@ -22,6 +22,8 @@ func init() {
SetFgBg: "\x1b[3%p1%d;4%p2%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm",
PadChar: "\x00", PadChar: "\x00",
AltChars: "jjkkllmmnnqqttuuvvwwxx", AltChars: "jjkkllmmnnqqttuuvvwwxx",
EnterAcs: "\x1b(0",
ExitAcs: "\x1b(B",
SetCursor: "\x1b[%i%p1%d;%p2%dH", SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b", CursorBack1: "\b",
CursorUp1: "\x1b[A", CursorUp1: "\x1b[A",

View File

@ -43,7 +43,7 @@ func init() {
KeyLeft: "\x1b[D", KeyLeft: "\x1b[D",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1b[7~", KeyHome: "\x1b[7~",
KeyEnd: "\x1b[8~", KeyEnd: "\x1b[8~",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",

26
vendor/maunium.net/go/tcell/terminfo/term_eterm.go generated vendored Normal file
View File

@ -0,0 +1,26 @@
// Generated automatically. DO NOT HAND-EDIT.
package terminfo
func init() {
// gnu emacs term.el terminal emulation
AddTerminfo(&Terminfo{
Name: "eterm",
Columns: 80,
Lines: 24,
Bell: "\a",
Clear: "\x1b[H\x1b[J",
EnterCA: "\x1b7\x1b[?47h",
ExitCA: "\x1b[2J\x1b[?47l\x1b8",
AttrOff: "\x1b[m",
Underline: "\x1b[4m",
Bold: "\x1b[1m",
Italic: "\x1b[3m",
Strikethrough: "\x1b[9m",
Reverse: "\x1b[7m",
PadChar: "\x00",
SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b",
CursorUp1: "\x1b[A",
})
}

View File

@ -43,7 +43,7 @@ func init() {
KeyLeft: "\x1bOD", KeyLeft: "\x1bOD",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1bOH", KeyHome: "\x1bOH",
KeyEnd: "\x1bOF", KeyEnd: "\x1bOF",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",

View File

@ -32,7 +32,7 @@ func init() {
EnterAcs: "\x0e", EnterAcs: "\x0e",
ExitAcs: "\x0f", ExitAcs: "\x0f",
EnableAcs: "\x1b)0", EnableAcs: "\x1b)0",
Mouse: "\x1b[M", Mouse: "\x1b[<",
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", 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",
SetCursor: "\x1b[%i%p1%d;%p2%dH", SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b", CursorBack1: "\b",
@ -43,7 +43,7 @@ func init() {
KeyLeft: "\x1bOD", KeyLeft: "\x1bOD",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1bOH", KeyHome: "\x1bOH",
KeyEnd: "\x1bOF", KeyEnd: "\x1bOF",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",

View File

@ -11,7 +11,7 @@ func init() {
Lines: 24, Lines: 24,
Bell: "\a", Bell: "\a",
Clear: "\x1b&a0y0C\x1bJ", Clear: "\x1b&a0y0C\x1bJ",
AttrOff: "\x1b&d@", AttrOff: "\x1b&d@\x0f",
Underline: "\x1b&dD", Underline: "\x1b&dD",
Bold: "\x1b&dB", Bold: "\x1b&dB",
Italic: "\x1b[3m", Italic: "\x1b[3m",

View File

@ -19,6 +19,7 @@ func init() {
Bold: "\x1b[1m", Bold: "\x1b[1m",
Italic: "\x1b[3m", Italic: "\x1b[3m",
Strikethrough: "\x1b[9m", Strikethrough: "\x1b[9m",
Dim: "\x1b[2m",
Blink: "\x1b[5m", Blink: "\x1b[5m",
Reverse: "\x1b[7m", Reverse: "\x1b[7m",
EnterKeypad: "\x1b[?1h\x1b=", EnterKeypad: "\x1b[?1h\x1b=",
@ -41,7 +42,7 @@ func init() {
KeyLeft: "\x1bOD", KeyLeft: "\x1bOD",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1bOH", KeyHome: "\x1bOH",
KeyEnd: "\x1bOF", KeyEnd: "\x1bOF",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",
@ -110,5 +111,45 @@ func init() {
KeyF62: "\x1bO4Q", KeyF62: "\x1bO4Q",
KeyF63: "\x1bO4R", KeyF63: "\x1bO4R",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
KeyShfLeft: "\x1b[1;2D",
KeyShfRight: "\x1b[1;2C",
KeyShfUp: "\x1b[1;2A",
KeyShfDown: "\x1b[1;2B",
KeyCtrlLeft: "\x1b[1;5D",
KeyCtrlRight: "\x1b[1;5C",
KeyCtrlUp: "\x1b[1;5A",
KeyCtrlDown: "\x1b[1;5B",
KeyMetaLeft: "\x1b[1;9D",
KeyMetaRight: "\x1b[1;9C",
KeyMetaUp: "\x1b[1;9A",
KeyMetaDown: "\x1b[1;9B",
KeyAltLeft: "\x1b[1;3D",
KeyAltRight: "\x1b[1;3C",
KeyAltUp: "\x1b[1;3A",
KeyAltDown: "\x1b[1;3B",
KeyAltShfLeft: "\x1b[1;4D",
KeyAltShfRight: "\x1b[1;4C",
KeyAltShfUp: "\x1b[1;4A",
KeyAltShfDown: "\x1b[1;4B",
KeyMetaShfLeft: "\x1b[1;10D",
KeyMetaShfRight: "\x1b[1;10C",
KeyMetaShfUp: "\x1b[1;10A",
KeyMetaShfDown: "\x1b[1;10B",
KeyCtrlShfLeft: "\x1b[1;6D",
KeyCtrlShfRight: "\x1b[1;6C",
KeyCtrlShfUp: "\x1b[1;6A",
KeyCtrlShfDown: "\x1b[1;6B",
KeyShfHome: "\x1b[1;2H",
KeyShfEnd: "\x1b[1;2F",
KeyCtrlHome: "\x1b[1;5H",
KeyCtrlEnd: "\x1b[1;5F",
KeyAltHome: "\x1b[1;9H",
KeyAltEnd: "\x1b[1;9F",
KeyCtrlShfHome: "\x1b[1;6H",
KeyCtrlShfEnd: "\x1b[1;6F",
KeyMetaShfHome: "\x1b[1;10H",
KeyMetaShfEnd: "\x1b[1;10F",
KeyAltShfHome: "\x1b[1;4H",
KeyAltShfEnd: "\x1b[1;4F",
}) })
} }

View File

@ -19,6 +19,7 @@ func init() {
Bold: "\x1b[1m", Bold: "\x1b[1m",
Italic: "\x1b[3m", Italic: "\x1b[3m",
Strikethrough: "\x1b[9m", Strikethrough: "\x1b[9m",
Dim: "\x1b[2m",
Blink: "\x1b[5m", Blink: "\x1b[5m",
Reverse: "\x1b[7m", Reverse: "\x1b[7m",
EnterKeypad: "\x1b[?1h\x1b=", EnterKeypad: "\x1b[?1h\x1b=",
@ -41,7 +42,7 @@ func init() {
KeyLeft: "\x1bOD", KeyLeft: "\x1bOD",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1bOH", KeyHome: "\x1bOH",
KeyEnd: "\x1bOF", KeyEnd: "\x1bOF",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",
@ -110,5 +111,45 @@ func init() {
KeyF62: "\x1bO4Q", KeyF62: "\x1bO4Q",
KeyF63: "\x1bO4R", KeyF63: "\x1bO4R",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
KeyShfLeft: "\x1b[1;2D",
KeyShfRight: "\x1b[1;2C",
KeyShfUp: "\x1b[1;2A",
KeyShfDown: "\x1b[1;2B",
KeyCtrlLeft: "\x1b[1;5D",
KeyCtrlRight: "\x1b[1;5C",
KeyCtrlUp: "\x1b[1;5A",
KeyCtrlDown: "\x1b[1;5B",
KeyMetaLeft: "\x1b[1;9D",
KeyMetaRight: "\x1b[1;9C",
KeyMetaUp: "\x1b[1;9A",
KeyMetaDown: "\x1b[1;9B",
KeyAltLeft: "\x1b[1;3D",
KeyAltRight: "\x1b[1;3C",
KeyAltUp: "\x1b[1;3A",
KeyAltDown: "\x1b[1;3B",
KeyAltShfLeft: "\x1b[1;4D",
KeyAltShfRight: "\x1b[1;4C",
KeyAltShfUp: "\x1b[1;4A",
KeyAltShfDown: "\x1b[1;4B",
KeyMetaShfLeft: "\x1b[1;10D",
KeyMetaShfRight: "\x1b[1;10C",
KeyMetaShfUp: "\x1b[1;10A",
KeyMetaShfDown: "\x1b[1;10B",
KeyCtrlShfLeft: "\x1b[1;6D",
KeyCtrlShfRight: "\x1b[1;6C",
KeyCtrlShfUp: "\x1b[1;6A",
KeyCtrlShfDown: "\x1b[1;6B",
KeyShfHome: "\x1b[1;2H",
KeyShfEnd: "\x1b[1;2F",
KeyCtrlHome: "\x1b[1;5H",
KeyCtrlEnd: "\x1b[1;5F",
KeyAltHome: "\x1b[1;9H",
KeyAltEnd: "\x1b[1;9F",
KeyCtrlShfHome: "\x1b[1;6H",
KeyCtrlShfEnd: "\x1b[1;6F",
KeyMetaShfHome: "\x1b[1;10H",
KeyMetaShfEnd: "\x1b[1;10F",
KeyAltShfHome: "\x1b[1;4H",
KeyAltShfEnd: "\x1b[1;4F",
}) })
} }

View File

@ -39,7 +39,7 @@ func init() {
KeyLeft: "\x1bOD", KeyLeft: "\x1bOD",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\b", KeyBackspace: "\xff",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",
KeyPgDn: "\x1b[6~", KeyPgDn: "\x1b[6~",
KeyF1: "\x1b[11~", KeyF1: "\x1b[11~",

View File

@ -26,7 +26,7 @@ func init() {
AltChars: "++,,--..00__``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}c~~", AltChars: "++,,--..00__``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}c~~",
EnterAcs: "\x0e", EnterAcs: "\x0e",
ExitAcs: "\x0f", ExitAcs: "\x0f",
EnableAcs: "\x1b(B\x1b)0", EnableAcs: "\x1b)0",
Mouse: "\x1b[M", Mouse: "\x1b[M",
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", 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",
SetCursor: "\x1b[%i%p1%d;%p2%dH", SetCursor: "\x1b[%i%p1%d;%p2%dH",
@ -38,7 +38,7 @@ func init() {
KeyLeft: "\x1b[D", KeyLeft: "\x1b[D",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1b[1~", KeyHome: "\x1b[1~",
KeyEnd: "\x1b[4~", KeyEnd: "\x1b[4~",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",

View File

@ -43,7 +43,7 @@ func init() {
KeyLeft: "\x1b[D", KeyLeft: "\x1b[D",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1b[7~", KeyHome: "\x1b[7~",
KeyEnd: "\x1b[8~", KeyEnd: "\x1b[8~",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",

View File

@ -43,7 +43,7 @@ func init() {
KeyLeft: "\x1b[D", KeyLeft: "\x1b[D",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1b[7~", KeyHome: "\x1b[7~",
KeyEnd: "\x1b[8~", KeyEnd: "\x1b[8~",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",

View File

@ -41,7 +41,7 @@ func init() {
KeyLeft: "\x1b[D", KeyLeft: "\x1b[D",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1b[7~", KeyHome: "\x1b[7~",
KeyEnd: "\x1b[8~", KeyEnd: "\x1b[8~",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",

View File

@ -41,7 +41,7 @@ func init() {
KeyLeft: "\x1b[D", KeyLeft: "\x1b[D",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1b[7~", KeyHome: "\x1b[7~",
KeyEnd: "\x1b[8~", KeyEnd: "\x1b[8~",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",

View File

@ -44,7 +44,7 @@ func init() {
KeyLeft: "\x1bOD", KeyLeft: "\x1bOD",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1b[1~", KeyHome: "\x1b[1~",
KeyEnd: "\x1b[4~", KeyEnd: "\x1b[4~",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",

View File

@ -44,7 +44,7 @@ func init() {
KeyLeft: "\x1bOD", KeyLeft: "\x1bOD",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1b[1~", KeyHome: "\x1b[1~",
KeyEnd: "\x1b[4~", KeyEnd: "\x1b[4~",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",

View File

@ -3,7 +3,7 @@
package terminfo package terminfo
func init() { func init() {
// simpleterm 0.4.1 // simpleterm
AddTerminfo(&Terminfo{ AddTerminfo(&Terminfo{
Name: "st", Name: "st",
Aliases: []string{"stterm"}, Aliases: []string{"stterm"},
@ -21,6 +21,7 @@ func init() {
Bold: "\x1b[1m", Bold: "\x1b[1m",
Italic: "\x1b[3m", Italic: "\x1b[3m",
Strikethrough: "\x1b[9m", Strikethrough: "\x1b[9m",
Dim: "\x1b[2m",
Blink: "\x1b[5m", Blink: "\x1b[5m",
Reverse: "\x1b[7m", Reverse: "\x1b[7m",
EnterKeypad: "\x1b[?1h\x1b=", EnterKeypad: "\x1b[?1h\x1b=",
@ -28,8 +29,7 @@ func init() {
SetFg: "\x1b[3%p1%dm", SetFg: "\x1b[3%p1%dm",
SetBg: "\x1b[4%p1%dm", SetBg: "\x1b[4%p1%dm",
SetFgBg: "\x1b[3%p1%d;4%p2%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm",
PadChar: "\x00", AltChars: "+C,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~",
AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~",
EnterAcs: "\x1b(0", EnterAcs: "\x1b(0",
ExitAcs: "\x1b(B", ExitAcs: "\x1b(B",
EnableAcs: "\x1b)0", EnableAcs: "\x1b)0",
@ -44,7 +44,7 @@ func init() {
KeyLeft: "\x1bOD", KeyLeft: "\x1bOD",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1b[1~", KeyHome: "\x1b[1~",
KeyEnd: "\x1b[4~", KeyEnd: "\x1b[4~",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",
@ -113,7 +113,6 @@ func init() {
KeyF62: "\x1b[1;4Q", KeyF62: "\x1b[1;4Q",
KeyF63: "\x1b[1;4R", KeyF63: "\x1b[1;4R",
KeyClear: "\x1b[3;5~", KeyClear: "\x1b[3;5~",
KeyBacktab: "\x1b[Z",
KeyShfLeft: "\x1b[1;2D", KeyShfLeft: "\x1b[1;2D",
KeyShfRight: "\x1b[1;2C", KeyShfRight: "\x1b[1;2C",
KeyShfUp: "\x1b[1;2A", KeyShfUp: "\x1b[1;2A",

View File

@ -21,6 +21,7 @@ func init() {
Bold: "\x1b[1m", Bold: "\x1b[1m",
Italic: "\x1b[3m", Italic: "\x1b[3m",
Strikethrough: "\x1b[9m", Strikethrough: "\x1b[9m",
Dim: "\x1b[2m",
Blink: "\x1b[5m", Blink: "\x1b[5m",
Reverse: "\x1b[7m", Reverse: "\x1b[7m",
EnterKeypad: "\x1b[?1h\x1b=", EnterKeypad: "\x1b[?1h\x1b=",
@ -28,8 +29,7 @@ func init() {
SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m",
SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m",
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", 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",
PadChar: "\x00", AltChars: "+C,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~",
AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~",
EnterAcs: "\x1b(0", EnterAcs: "\x1b(0",
ExitAcs: "\x1b(B", ExitAcs: "\x1b(B",
EnableAcs: "\x1b)0", EnableAcs: "\x1b)0",
@ -44,7 +44,7 @@ func init() {
KeyLeft: "\x1bOD", KeyLeft: "\x1bOD",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1b[1~", KeyHome: "\x1b[1~",
KeyEnd: "\x1b[4~", KeyEnd: "\x1b[4~",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",
@ -113,7 +113,6 @@ func init() {
KeyF62: "\x1b[1;4Q", KeyF62: "\x1b[1;4Q",
KeyF63: "\x1b[1;4R", KeyF63: "\x1b[1;4R",
KeyClear: "\x1b[3;5~", KeyClear: "\x1b[3;5~",
KeyBacktab: "\x1b[Z",
KeyShfLeft: "\x1b[1;2D", KeyShfLeft: "\x1b[1;2D",
KeyShfRight: "\x1b[1;2C", KeyShfRight: "\x1b[1;2C",
KeyShfUp: "\x1b[1;2A", KeyShfUp: "\x1b[1;2A",

View File

@ -24,7 +24,7 @@ func init() {
KeyRight: "\x1b[C", KeyRight: "\x1b[C",
KeyLeft: "\x1b[D", KeyLeft: "\x1b[D",
KeyInsert: "\x1b[247z", KeyInsert: "\x1b[247z",
KeyDelete: "\u007f", KeyDelete: "\xff",
KeyBackspace: "\b", KeyBackspace: "\b",
KeyHome: "\x1b[214z", KeyHome: "\x1b[214z",
KeyEnd: "\x1b[220z", KeyEnd: "\x1b[220z",

View File

@ -28,7 +28,7 @@ func init() {
KeyRight: "\x1b[C", KeyRight: "\x1b[C",
KeyLeft: "\x1b[D", KeyLeft: "\x1b[D",
KeyInsert: "\x1b[247z", KeyInsert: "\x1b[247z",
KeyDelete: "\u007f", KeyDelete: "\xff",
KeyBackspace: "\b", KeyBackspace: "\b",
KeyHome: "\x1b[214z", KeyHome: "\x1b[214z",
KeyEnd: "\x1b[220z", KeyEnd: "\x1b[220z",

View File

@ -35,7 +35,7 @@ func init() {
KeyLeft: "\x1bOD", KeyLeft: "\x1bOD",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1b[1~", KeyHome: "\x1b[1~",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",
KeyPgDn: "\x1b[6~", KeyPgDn: "\x1b[6~",

View File

@ -42,7 +42,7 @@ func init() {
KeyLeft: "\x1bOD", KeyLeft: "\x1bOD",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1bOH", KeyHome: "\x1bOH",
KeyEnd: "\x1bOF", KeyEnd: "\x1bOF",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",

View File

@ -28,6 +28,6 @@ func init() {
KeyDown: "\x1bOB", KeyDown: "\x1bOB",
KeyRight: "\x1bOC", KeyRight: "\x1bOC",
KeyLeft: "\x1bOD", KeyLeft: "\x1bOD",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
}) })
} }

View File

@ -12,8 +12,8 @@ func init() {
Colors: 8, Colors: 8,
Bell: "\a", Bell: "\a",
Clear: "\x1b[H\x1b[2J", Clear: "\x1b[H\x1b[2J",
EnterCA: "\x1b[?1049h", EnterCA: "\x1b[?1049h\x1b[22;0;0t",
ExitCA: "\x1b[?1049l", ExitCA: "\x1b[?1049l\x1b[23;0;0t",
ShowCursor: "\x1b[?12l\x1b[?25h", ShowCursor: "\x1b[?12l\x1b[?25h",
HideCursor: "\x1b[?25l", HideCursor: "\x1b[?25l",
AttrOff: "\x1b(B\x1b[m", AttrOff: "\x1b(B\x1b[m",
@ -43,7 +43,7 @@ func init() {
KeyLeft: "\x1bOD", KeyLeft: "\x1bOD",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1bOH", KeyHome: "\x1bOH",
KeyEnd: "\x1bOF", KeyEnd: "\x1bOF",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",

View File

@ -11,8 +11,8 @@ func init() {
Colors: 256, Colors: 256,
Bell: "\a", Bell: "\a",
Clear: "\x1b[H\x1b[2J", Clear: "\x1b[H\x1b[2J",
EnterCA: "\x1b[?1049h", EnterCA: "\x1b[?1049h\x1b[22;0;0t",
ExitCA: "\x1b[?1049l", ExitCA: "\x1b[?1049l\x1b[23;0;0t",
ShowCursor: "\x1b[?12l\x1b[?25h", ShowCursor: "\x1b[?12l\x1b[?25h",
HideCursor: "\x1b[?25l", HideCursor: "\x1b[?25l",
AttrOff: "\x1b(B\x1b[m", AttrOff: "\x1b(B\x1b[m",
@ -42,7 +42,7 @@ func init() {
KeyLeft: "\x1bOD", KeyLeft: "\x1bOD",
KeyInsert: "\x1b[2~", KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~", KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f", KeyBackspace: "\xff",
KeyHome: "\x1bOH", KeyHome: "\x1bOH",
KeyEnd: "\x1bOF", KeyEnd: "\x1bOF",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",

View File

@ -1,4 +1,4 @@
// Copyright 2017 The TCell Authors // Copyright 2018 The TCell Authors
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License. // you may not use file except in compliance with the License.
@ -17,12 +17,14 @@ package terminfo
import ( import (
"bytes" "bytes"
"compress/gzip" "compress/gzip"
"crypto/sha1"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"io" "io"
"os" "os"
"path" "path"
"path/filepath"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
@ -757,8 +759,16 @@ func loadFromFile(fname string, term string) (*Terminfo, error) {
// LookupTerminfo attempts to find a definition for the named $TERM. // LookupTerminfo attempts to find a definition for the named $TERM.
// It first looks in the builtin database, which should cover just about // It first looks in the builtin database, which should cover just about
// everyone. If it can't find one there, then it will attempt to read // everyone. If it can't find one there, then it will attempt to read
// one from the JSON file located in either $TCELLDB, $HOME/.tcelldb // one from the JSON file located in either $TCELLDB, $HOME/.tcelldb,
// or in this package's source directory as database.json). // or as a database file.
//
// The database files are named by taking terminal name, hashing it through
// sha1, and then a subdirectory of the form database/hash[0:2]/hash[0:8]
// (with an optional .gz extension).
//
// For other local database files, we will look for the database file using
// the terminal name, so database/term[0:2]/term[0:8], again with optional
// .gz extension.
func LookupTerminfo(name string) (*Terminfo, error) { func LookupTerminfo(name string) (*Terminfo, error) {
if name == "" { if name == "" {
// else on windows: index out of bounds // else on windows: index out of bounds
@ -776,38 +786,65 @@ func LookupTerminfo(name string) (*Terminfo, error) {
letter := fmt.Sprintf("%02x", name[0]) letter := fmt.Sprintf("%02x", name[0])
gzfile := path.Join(letter, name+".gz") gzfile := path.Join(letter, name+".gz")
jsfile := path.Join(letter, name) jsfile := path.Join(letter, name)
hash := fmt.Sprintf("%x", sha1.Sum([]byte(name)))
gzhfile := path.Join(hash[0:2], hash[0:8]+".gz")
jshfile := path.Join(hash[0:2], hash[0:8])
// Build up the search path. Old versions of tcell used a // Build up the search path. Old versions of tcell used a
// single database file, whereas the new ones locate them // single database file, whereas the new ones locate them
// in JSON (optionally compressed) files. // in JSON (optionally compressed) files.
// //
// The search path looks like: // The search path for "xterm" (SHA1 sig e2e28a8e...) looks
// like this:
// //
// $TCELLDB/x/xterm.gz // $TCELLDB/78/xterm.gz
// $TCELLDB/x/xterm // $TCELLDB/78/xterm
// $TCELLDB // $TCELLDB
// $HOME/.tcelldb/x/xterm.gz // $HOME/.tcelldb/e2/e2e28a8e.gz
// $HOME/.tcelldb/x/xterm // $HOME/.tcelldb/e2/e2e28a8e
// $HOME/.tcelldb/78/xterm.gz
// $HOME/.tcelldb/78/xterm
// $HOME/.tcelldb // $HOME/.tcelldb
// $GOPATH/terminfo/database/x/xterm.gz // $GOPATH/terminfo/database/e2/e2e28a8e.gz
// $GOPATH/terminfo/database/x/xterm // $GOPATH/terminfo/database/e2/e2e28a8e
// $GOPATH/terminfo/database/78/xterm.gz
// $GOPATH/terminfo/database/78/xterm
// //
// Note that the legacy name lookups (78/xterm etc.) are
// provided for compatibility. We do not actually deliver
// any files with this style of naming, to avoid collisions
// on case insensitive filesystems. (*cough* mac *cough*).
// If $GOPATH set, honor it, else assume $HOME/go just like
// modern golang does.
gopath := os.Getenv("GOPATH")
if gopath == "" {
gopath = path.Join(os.Getenv("HOME"), "go")
}
if pth := os.Getenv("TCELLDB"); pth != "" { if pth := os.Getenv("TCELLDB"); pth != "" {
files = append(files, path.Join(pth, gzfile)) files = append(files,
files = append(files, path.Join(pth, jsfile)) path.Join(pth, gzfile),
files = append(files, pth) path.Join(pth, jsfile),
pth)
} }
if pth := os.Getenv("HOME"); pth != "" { if pth := os.Getenv("HOME"); pth != "" {
pth = path.Join(pth, ".tcelldb") pth = path.Join(pth, ".tcelldb")
files = append(files, path.Join(pth, gzfile)) files = append(files,
files = append(files, path.Join(pth, jsfile)) path.Join(pth, gzhfile),
files = append(files, pth) path.Join(pth, jshfile),
path.Join(pth, gzfile),
path.Join(pth, jsfile),
pth)
} }
for _, pth := range strings.Split(os.Getenv("GOPATH"), string(os.PathListSeparator)) { for _, pth := range filepath.SplitList(gopath) {
pth = path.Join(pth, "src", "github.com", "gdamore", "tcell", "terminfo", "database") pth = path.Join(pth, "src", "github.com",
files = append(files, path.Join(pth, gzfile)) "gdamore", "tcell", "terminfo", "database")
files = append(files, path.Join(pth, jsfile)) files = append(files,
path.Join(pth, gzhfile),
path.Join(pth, jshfile),
path.Join(pth, gzfile),
path.Join(pth, jsfile))
} }
for _, fname := range files { for _, fname := range files {