bump gocui to be on 'simple' branch.

The master branch of gocui contains stuff I added for lazynpm which changes how
the cursor is used. This will provide some benefits to lazygit as well but I
don't yet have the motivation to make the required changed in lazygit to support it.

So we're gonna be on the branch named 'simple' rather than master until I fix that up.
This commit is contained in:
Jesse Duffield 2020-05-13 21:08:53 +10:00
parent 7ed8ee160d
commit d5db02a899
13 changed files with 282 additions and 230 deletions

View file

@ -91,6 +91,10 @@ func New(e interface{}) *Error {
// fmt.Errorf("%v"). The skip parameter indicates how far up the stack
// to start the stacktrace. 0 is from the current call, 1 from its caller, etc.
func Wrap(e interface{}, skip int) *Error {
if e == nil {
return nil
}
var err error
switch e := e.(type) {
@ -117,6 +121,9 @@ func Wrap(e interface{}, skip int) *Error {
// up the stack to start the stacktrace. 0 is from the current call,
// 1 from its caller, etc.
func WrapPrefix(e interface{}, prefix string, skip int) *Error {
if e == nil {
return nil
}
err := Wrap(e, 1+skip)

3
vendor/github.com/go-errors/errors/go.mod generated vendored Normal file
View file

@ -0,0 +1,3 @@
module github.com/go-errors/errors
go 1.14

View file

@ -1,9 +1,10 @@
package errors
import (
"bufio"
"bytes"
"fmt"
"io/ioutil"
"os"
"runtime"
"strings"
)
@ -62,18 +63,29 @@ func (frame *StackFrame) String() string {
// SourceLine gets the line of code (from File and Line) of the original source if possible.
func (frame *StackFrame) SourceLine() (string, error) {
data, err := ioutil.ReadFile(frame.File)
if frame.LineNumber <= 0 {
return "???", nil
}
file, err := os.Open(frame.File)
if err != nil {
return "", New(err)
}
defer file.Close()
lines := bytes.Split(data, []byte{'\n'})
if frame.LineNumber <= 0 || frame.LineNumber >= len(lines) {
return "???", nil
scanner := bufio.NewScanner(file)
currentLine := 1
for scanner.Scan() {
if currentLine == frame.LineNumber {
return string(bytes.Trim(scanner.Bytes(), " \t")), nil
}
currentLine++
}
// -1 because line-numbers are 1 based, but our array is 0 based
return string(bytes.Trim(lines[frame.LineNumber-1], " \t")), nil
if err := scanner.Err(); err != nil {
return "", New(err)
}
return "???", nil
}
func packageAndName(fn *runtime.Func) (string, string) {