1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-05 00:59:19 +02:00

bump dependencies

This commit is contained in:
Jesse Duffield
2021-06-15 08:12:38 +10:00
parent ce7cbe58a0
commit 3dd88d6138
32 changed files with 396 additions and 115 deletions

View File

@ -54,6 +54,7 @@ Version 1.x remains available using the import `github.com/gdamore/tcell`.
* https://github.com/noborus/ov[ov] - Terminal pager
* https://github.com/gcla/tmux-wormhole[tmux-wormhole] - A tmux plugin to transfer files with magic wormhole
* https://github.com/anaseto/gruid-tcell[gruid-tcell] - A tcell driver for the grid based UI and game framework gruid.
* https://github.com/aretext/aretext[aretext] - Minimalist text editor with vim key bindings.
== Pure Go Terminfo Database

View File

@ -6,8 +6,6 @@ github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRR
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=

View File

@ -26,6 +26,7 @@ import (
// tcSetBufParams is used by the tty driver on UNIX systems to configure the
// buffering parameters (minimum character count and minimum wait time in msec.)
// This also waits for output to drain first.
func tcSetBufParams(fd int, vMin uint8, vTime uint8) error {
_ = syscall.SetNonblock(fd, true)
tio, err := unix.IoctlGetTermios(fd, unix.TIOCGETA)
@ -34,7 +35,7 @@ func tcSetBufParams(fd int, vMin uint8, vTime uint8) error {
}
tio.Cc[unix.VMIN] = vMin
tio.Cc[unix.VTIME] = vTime
if err = unix.IoctlSetTermios(fd, unix.TIOCSETA, tio); err != nil {
if err = unix.IoctlSetTermios(fd, unix.TIOCSETAW, tio); err != nil {
return err
}
return nil

View File

@ -24,6 +24,7 @@ import (
// tcSetBufParams is used by the tty driver on UNIX systems to configure the
// buffering parameters (minimum character count and minimum wait time in msec.)
// This also waits for output to drain first.
func tcSetBufParams(fd int, vMin uint8, vTime uint8) error {
_ = syscall.SetNonblock(fd, true)
tio, err := unix.IoctlGetTermios(fd, unix.TCGETS)
@ -32,7 +33,7 @@ func tcSetBufParams(fd int, vMin uint8, vTime uint8) error {
}
tio.Cc[unix.VMIN] = vMin
tio.Cc[unix.VTIME] = vTime
if err = unix.IoctlSetTermios(fd, unix.TCSETS, tio); err != nil {
if err = unix.IoctlSetTermios(fd, unix.TCSETSW, tio); err != nil {
return err
}
return nil

177
vendor/github.com/gdamore/tcell/v2/stdin_unix.go generated vendored Normal file
View File

@ -0,0 +1,177 @@
// 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 aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
package tcell
import (
"errors"
"fmt"
"os"
"os/signal"
"strconv"
"sync"
"syscall"
"time"
"golang.org/x/term"
)
// stdIoTty is an implementation of the Tty API based upon stdin/stdout.
type stdIoTty struct {
fd int
in *os.File
out *os.File
saved *term.State
sig chan os.Signal
cb func()
stopQ chan struct{}
dev string
wg sync.WaitGroup
l sync.Mutex
}
func (tty *stdIoTty) Read(b []byte) (int, error) {
return tty.in.Read(b)
}
func (tty *stdIoTty) Write(b []byte) (int, error) {
return tty.out.Write(b)
}
func (tty *stdIoTty) Close() error {
return nil
}
func (tty *stdIoTty) Start() error {
tty.l.Lock()
defer tty.l.Unlock()
// We open another copy of /dev/tty. This is a workaround for unusual behavior
// observed in macOS, apparently caused when a subshell (for example) closes our
// own tty device (when it exits for example). Getting a fresh new one seems to
// resolve the problem. (We believe this is a bug in the macOS tty driver that
// fails to account for dup() references to the same file before applying close()
// related behaviors to the tty.) We're also holding the original copy we opened
// since closing that might have deleterious effects as well. The upshot is that
// we will have up to two separate file handles open on /dev/tty. (Note that when
// using stdin/stdout instead of /dev/tty this problem is not observed.)
var err error
tty.in = os.Stdin
tty.out = os.Stdout
tty.fd = int(tty.in.Fd())
if !term.IsTerminal(tty.fd) {
return errors.New("device is not a terminal")
}
_ = tty.in.SetReadDeadline(time.Time{})
saved, err := term.MakeRaw(tty.fd) // also sets vMin and vTime
if err != nil {
return err
}
tty.saved = saved
tty.stopQ = make(chan struct{})
tty.wg.Add(1)
go func(stopQ chan struct{}) {
defer tty.wg.Done()
for {
select {
case <-tty.sig:
tty.l.Lock()
cb := tty.cb
tty.l.Unlock()
if cb != nil {
cb()
}
case <-stopQ:
return
}
}
}(tty.stopQ)
signal.Notify(tty.sig, syscall.SIGWINCH)
return nil
}
func (tty *stdIoTty) Drain() error {
_ = tty.in.SetReadDeadline(time.Now())
if err := tcSetBufParams(tty.fd, 0, 0); err != nil {
return err
}
return nil
}
func (tty *stdIoTty) Stop() error {
tty.l.Lock()
if err := term.Restore(tty.fd, tty.saved); err != nil {
tty.l.Unlock()
return err
}
_ = tty.in.SetReadDeadline(time.Now())
signal.Stop(tty.sig)
close(tty.stopQ)
tty.l.Unlock()
tty.wg.Wait()
return nil
}
func (tty *stdIoTty) WindowSize() (int, int, error) {
w, h, err := term.GetSize(tty.fd)
if err != nil {
return 0, 0, err
}
if w == 0 {
w, _ = strconv.Atoi(os.Getenv("COLUMNS"))
}
if w == 0 {
w = 80 // default
}
if h == 0 {
h, _ = strconv.Atoi(os.Getenv("LINES"))
}
if h == 0 {
h = 25 // default
}
return w, h, nil
}
func (tty *stdIoTty) NotifyResize(cb func()) {
tty.l.Lock()
tty.cb = cb
tty.l.Unlock()
}
// NewStdioTty opens a tty using standard input/output.
func NewStdIoTty() (Tty, error) {
tty := &stdIoTty{
sig: make(chan os.Signal),
in: os.Stdin,
out: os.Stdout,
}
var err error
tty.fd = int(tty.in.Fd())
if !term.IsTerminal(tty.fd) {
return nil, errors.New("not a terminal")
}
if tty.saved, err = term.GetState(tty.fd); err != nil {
return nil, fmt.Errorf("failed to get state: %w", err)
}
return tty, nil
}

View File

@ -28,6 +28,7 @@ import (
_ "github.com/gdamore/tcell/v2/terminfo/c/cygwin"
_ "github.com/gdamore/tcell/v2/terminfo/d/dtterm"
_ "github.com/gdamore/tcell/v2/terminfo/e/emacs"
_ "github.com/gdamore/tcell/v2/terminfo/f/foot"
_ "github.com/gdamore/tcell/v2/terminfo/g/gnome"
_ "github.com/gdamore/tcell/v2/terminfo/h/hpterm"
_ "github.com/gdamore/tcell/v2/terminfo/k/konsole"

View File

@ -0,0 +1,69 @@
// Generated automatically. DO NOT HAND-EDIT.
package foot
import "github.com/gdamore/tcell/v2/terminfo"
func init() {
// foot terminal emulator
terminfo.AddTerminfo(&terminfo.Terminfo{
Name: "foot",
Columns: 80,
Lines: 24,
Colors: 256,
Bell: "\a",
Clear: "\x1b[H\x1b[2J",
EnterCA: "\x1b[?1049h\x1b[22;0;0t",
ExitCA: "\x1b[?1049l\x1b[23;0;0t",
ShowCursor: "\x1b[?12l\x1b[?25h",
HideCursor: "\x1b[?25l",
AttrOff: "\x1b(B\x1b[m",
Underline: "\x1b[4m",
Bold: "\x1b[1m",
Dim: "\x1b[2m",
Italic: "\x1b[3m",
Blink: "\x1b[5m",
Reverse: "\x1b[7m",
EnterKeypad: "\x1b[?1h\x1b=",
ExitKeypad: "\x1b[?1l\x1b>",
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",
ResetFgBg: "\x1b[39;49m",
AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~",
EnterAcs: "\x1b(0",
ExitAcs: "\x1b(B",
StrikeThrough: "\x1b[9m",
Mouse: "\x1b[M",
SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b",
CursorUp1: "\x1b[A",
KeyUp: "\x1bOA",
KeyDown: "\x1bOB",
KeyRight: "\x1bOC",
KeyLeft: "\x1bOD",
KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f",
KeyHome: "\x1bOH",
KeyEnd: "\x1bOF",
KeyPgUp: "\x1b[5~",
KeyPgDn: "\x1b[6~",
KeyF1: "\x1bOP",
KeyF2: "\x1bOQ",
KeyF3: "\x1bOR",
KeyF4: "\x1bOS",
KeyF5: "\x1b[15~",
KeyF6: "\x1b[17~",
KeyF7: "\x1b[18~",
KeyF8: "\x1b[19~",
KeyF9: "\x1b[20~",
KeyF10: "\x1b[21~",
KeyF11: "\x1b[23~",
KeyF12: "\x1b[24~",
KeyBacktab: "\x1b[Z",
Modifiers: 1,
AutoMargin: true,
})
}

View File

@ -1682,6 +1682,7 @@ func (t *tScreen) disengage() {
ti := t.ti
t.cells.Resize(0, 0)
t.TPuts(ti.ShowCursor)
t.TPuts(ti.ResetFgBg)
t.TPuts(ti.AttrOff)
t.TPuts(ti.Clear)
t.TPuts(ti.ExitCA)

View File

@ -21,6 +21,7 @@ import (
"fmt"
"os"
"os/signal"
"strconv"
"sync"
"syscall"
"time"
@ -51,7 +52,7 @@ func (tty *devTty) Write(b []byte) (int, error) {
}
func (tty *devTty) Close() error {
return nil
return tty.f.Close()
}
func (tty *devTty) Start() error {
@ -136,7 +137,23 @@ func (tty *devTty) Stop() error {
}
func (tty *devTty) WindowSize() (int, int, error) {
return term.GetSize(tty.fd)
w, h, err := term.GetSize(tty.fd)
if err != nil {
return 0, 0, err
}
if w == 0 {
w, _ = strconv.Atoi(os.Getenv("COLUMNS"))
}
if w == 0 {
w = 80 // default
}
if h == 0 {
h, _ = strconv.Atoi(os.Getenv("LINES"))
}
if h == 0 {
h = 25 // default
}
return w, h, nil
}
func (tty *devTty) NotifyResize(cb func()) {

View File

@ -65,5 +65,16 @@ everyone can benefit.
This package is licensed under the MIT license, see LICENSE.MIT for details.
## Changelog
* v1.1.0 updated to use go1.13's standard-library errors.Is method instead of == in errors.Is
* v1.1.0 updated to use go1.13's standard-library errors.Is method instead of == in errors.Is
* v1.2.0 added `errors.As` from the standard library.
* v1.3.0 *BREAKING* updated error methods to return `error` instead of `*Error`.
> Code that needs access to the underlying `*Error` can use the new errors.AsError(e)
> ```
> // before
> errors.New(err).ErrorStack()
> // after
>. errors.AsError(errors.Wrap(err)).ErrorStack()
> ```
* v1.4.0 *BREAKING* v1.4.0 reverted all changes from v1.3.0 and is identical to v1.2.0

View File

@ -139,7 +139,6 @@ func WrapPrefix(e interface{}, prefix string, skip int) *Error {
}
// Errorf creates a new error with the given message. You can use it
// as a drop-in replacement for fmt.Errorf() to provide descriptive
// errors in return values.
@ -203,3 +202,8 @@ func (err *Error) TypeName() string {
}
return reflect.TypeOf(err.Err).String()
}
// Return the wrapped error (implements api for As function).
func (err *Error) Unwrap() error {
return err.Err
}

View File

@ -6,6 +6,11 @@ import (
baseErrors "errors"
)
// find error in any wrapped error
func As(err error, target interface{}) bool {
return baseErrors.As(err, target)
}
// Is detects whether the error is equal to a given error. Errors
// are considered equal by this function if they are matched by errors.Is
// or if their contained errors are matched through errors.Is

View File

@ -2,6 +2,41 @@
package errors
import (
"reflect"
)
type unwrapper interface {
Unwrap() error
}
// As assigns error or any wrapped error to the value target points
// to. If there is no value of the target type of target As returns
// false.
func As(err error, target interface{}) bool {
targetType := reflect.TypeOf(target)
for {
errType := reflect.TypeOf(err)
if errType == nil {
return false
}
if reflect.PtrTo(errType) == targetType {
reflect.ValueOf(target).Elem().Set(reflect.ValueOf(err))
return true
}
wrapped, ok := err.(unwrapper)
if ok {
err = wrapped.Unwrap()
} else {
return false
}
}
}
// Is detects whether the error is equal to a given error. Errors
// are considered equal by this function if they are the same object,
// or if they both contain the same error inside an errors.Error.
@ -19,4 +54,4 @@ func Is(e error, original error) bool {
}
return false
}
}

View File

@ -1,3 +1,6 @@
module github.com/go-errors/errors
go 1.14
// Was not API-compatible with earlier or later releases.
retract v1.3.0

View File

@ -134,6 +134,9 @@ type Gui struct {
// frame of the current view.
Highlight bool
// If ShowListFooter is true then show list footer (i.e. the part that says we're at item 5 out of 10)
ShowListFooter bool
// If Cursor is true then the cursor is enabled.
Cursor bool
@ -723,7 +726,7 @@ func (g *Gui) flush() error {
return err
}
}
if v.ContainsList {
if v.ContainsList && g.ShowListFooter {
if err := g.drawListFooter(v, fgColor, bgColor); err != nil {
return err
}