1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-03 13:21:56 +02:00

bump gocui

This commit is contained in:
Jesse Duffield 2022-10-02 12:47:57 -07:00
parent c953871ec7
commit 5670c0a301
26 changed files with 220 additions and 25 deletions

4
go.mod
View File

@ -18,7 +18,7 @@ require (
github.com/integrii/flaggy v1.4.0
github.com/jesseduffield/generics v0.0.0-20220320043834-727e535cbe68
github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4
github.com/jesseduffield/gocui v0.3.1-0.20220922032454-744b0c465c37
github.com/jesseduffield/gocui v0.3.1-0.20221001154429-72c39318a83d
github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10
github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e
github.com/jesseduffield/yaml v2.1.0+incompatible
@ -67,7 +67,7 @@ require (
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 // indirect
golang.org/x/exp v0.0.0-20220318154914-8dddf5d87bd8 // indirect
golang.org/x/net v0.0.0-20201002202402-0a1ea396d57c // indirect
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect
golang.org/x/term v0.0.0-20220919170432-7a66f970e087 // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect

8
go.sum
View File

@ -72,8 +72,8 @@ github.com/jesseduffield/generics v0.0.0-20220320043834-727e535cbe68 h1:EQP2Tv8T
github.com/jesseduffield/generics v0.0.0-20220320043834-727e535cbe68/go.mod h1:+LLj9/WUPAP8LqCchs7P+7X0R98HiFujVFANdNaxhGk=
github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4 h1:GOQrmaE8i+KEdB8NzAegKYd4tPn/inM0I1uo0NXFerg=
github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4/go.mod h1:nGNEErzf+NRznT+N2SWqmHnDnF9aLgANB1CUNEan09o=
github.com/jesseduffield/gocui v0.3.1-0.20220922032454-744b0c465c37 h1:EE21YiOAGGs4/K8l3V15w5ICJmDrfwhklm3adc4N/8A=
github.com/jesseduffield/gocui v0.3.1-0.20220922032454-744b0c465c37/go.mod h1:znJuCDnF2Ph40YZSlBwdX/4GEofnIoWLGdT4mK5zRAU=
github.com/jesseduffield/gocui v0.3.1-0.20221001154429-72c39318a83d h1:OTUa2dO3IvnY53QWCABkKJK9v5yvs3+uv3RMbG698S0=
github.com/jesseduffield/gocui v0.3.1-0.20221001154429-72c39318a83d/go.mod h1:znJuCDnF2Ph40YZSlBwdX/4GEofnIoWLGdT4mK5zRAU=
github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10 h1:jmpr7KpX2+2GRiE91zTgfq49QvgiqB0nbmlwZ8UnOx0=
github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10/go.mod h1:aA97kHeNA+sj2Hbki0pvLslmE4CbDyhBeSSTUUnOuVo=
github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e h1:uw/oo+kg7t/oeMs6sqlAwr85ND/9cpO3up3VxphxY0U=
@ -195,8 +195,8 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220318055525-2edf467146b5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc=
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI=
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20220919170432-7a66f970e087 h1:tPwmk4vmvVCMdr98VgL4JH+qZxPL8fqlUOHnyOM8N3w=
golang.org/x/term v0.0.0-20220919170432-7a66f970e087/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=

View File

@ -37,8 +37,12 @@ func SimpleEditor(v *View, key Key, ch rune, mod Modifier) bool {
v.TextArea.MoveCursorDown()
case key == KeyArrowUp:
v.TextArea.MoveCursorUp()
case key == KeyArrowLeft && (mod&ModAlt) != 0:
v.TextArea.MoveLeftWord()
case key == KeyArrowLeft:
v.TextArea.MoveCursorLeft()
case key == KeyArrowRight && (mod&ModAlt) != 0:
v.TextArea.MoveRightWord()
case key == KeyArrowRight:
v.TextArea.MoveCursorRight()
case key == KeyEnter:

View File

@ -214,6 +214,8 @@ func (ei *escapeInterpreter) outputNormal() error {
case p == 0:
ei.curFgColor = ColorDefault
ei.curBgColor = ColorDefault
case p >= 21 && p <= 29:
ei.curFgColor &= ^getFontEffect(p - 20)
default:
ei.curFgColor |= getFontEffect(p)
}

View File

@ -64,6 +64,54 @@ func (self *TextArea) MoveCursorRight() {
self.cursor++
}
func (self *TextArea) MoveLeftWord() {
if self.cursor == 0 {
return
}
if self.atLineStart() {
self.cursor--
return
}
for !self.atLineStart() && strings.ContainsRune(WHITESPACES, self.content[self.cursor-1]) {
self.cursor--
}
separators := false
for !self.atLineStart() && strings.ContainsRune(WORD_SEPARATORS, self.content[self.cursor-1]) {
self.cursor--
separators = true
}
if !separators {
for !self.atLineStart() && !strings.ContainsRune(WHITESPACES+WORD_SEPARATORS, self.content[self.cursor-1]) {
self.cursor--
}
}
}
func (self *TextArea) MoveRightWord() {
if self.atEnd() {
return
}
if self.atLineEnd() {
self.cursor++
return
}
for !self.atLineEnd() && strings.ContainsRune(WHITESPACES, self.content[self.cursor]) {
self.cursor++
}
separators := false
for !self.atLineEnd() && strings.ContainsRune(WORD_SEPARATORS, self.content[self.cursor]) {
self.cursor++
separators = true
}
if !separators {
for !self.atLineEnd() && !strings.ContainsRune(WHITESPACES+WORD_SEPARATORS, self.content[self.cursor]) {
self.cursor++
}
}
}
func (self *TextArea) MoveCursorUp() {
x, y := self.GetCursorXY()
self.SetCursor2D(x, y-1)

View File

@ -601,6 +601,14 @@ func (v *View) writeCells(x, y int, cells []cell) {
v.lines[y] = line[:newLen]
}
// readCell gets cell at specified location (x, y)
func (v *View) readCell(x, y int) (cell, bool) {
if y < 0 || y >= len(v.lines) || x < 0 || x >= len(v.lines[y]) {
return cell{}, false
}
return v.lines[y][x], true
}
// Write appends a byte slice into the view's internal buffer. Because
// View implements the io.Writer interface, it can be passed as parameter
// of functions like fmt.Fprintf, fmt.Fprintln, io.Copy, etc. Clear must
@ -631,17 +639,29 @@ func (v *View) writeRunes(p []rune) {
for _, r := range p {
switch r {
case '\n':
if c, ok := v.readCell(v.wx+1, v.wy); !ok || c.chr == 0 {
v.writeCells(v.wx, v.wy, []cell{{
chr: 0,
fgColor: 0,
bgColor: 0,
}})
}
v.wx = 0
v.wy++
if v.wy >= len(v.lines) {
v.lines = append(v.lines, nil)
}
fallthrough
// not valid in every OS, but making runtime OS checks in cycle is bad.
case '\r':
if c, ok := v.readCell(v.wx, v.wy); !ok || c.chr == 0 {
v.writeCells(v.wx, v.wy, []cell{{
chr: 0,
fgColor: 0,
bgColor: 0,
}})
}
v.wx = 0
default:
moveCursor, cells := v.parseInput(r)
moveCursor, cells := v.parseInput(r, v.wx, v.wy)
if cells == nil {
continue
}
@ -666,7 +686,7 @@ func (v *View) writeString(s string) {
// parseInput parses char by char the input written to the View. It returns nil
// while processing ESC sequences. Otherwise, it returns a cell slice that
// contains the processed data.
func (v *View) parseInput(ch rune) (bool, []cell) {
func (v *View) parseInput(ch rune, x int, y int) (bool, []cell) {
cells := []cell{}
moveCursor := true
@ -698,8 +718,9 @@ func (v *View) parseInput(ch rune) (bool, []cell) {
return moveCursor, nil
} else if ch == '\t' {
// fill tab-sized space
const tabStop = 4
ch = ' '
repeatCount = 4
repeatCount = tabStop - (x % tabStop)
}
c := cell{
fgColor: v.ei.curFgColor,
@ -936,11 +957,14 @@ func (v *View) draw() error {
if y >= maxY {
break
}
x := 0
x := -v.ox
j := 0
var c cell
for {
if j < v.ox {
if x < 0 {
if j < len(vline.line) {
x += runewidth.RuneWidth(vline.line[j].chr)
}
j++
continue
}

View File

@ -2252,7 +2252,7 @@ func (fh *FileHandle) Bytes() []byte {
if n == 0 {
return nil
}
return (*[1 << 30]byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&fh.fileHandle.Type)) + 4))[:n:n]
return unsafe.Slice((*byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&fh.fileHandle.Type))+4)), n)
}
// NameToHandleAt wraps the name_to_handle_at system call; it obtains
@ -2368,6 +2368,16 @@ func Setitimer(which ItimerWhich, it Itimerval) (Itimerval, error) {
return prev, nil
}
//sysnb rtSigprocmask(how int, set *Sigset_t, oldset *Sigset_t, sigsetsize uintptr) (err error) = SYS_RT_SIGPROCMASK
func PthreadSigmask(how int, set, oldset *Sigset_t) error {
if oldset != nil {
// Explicitly clear in case Sigset_t is larger than _C__NSIG.
*oldset = Sigset_t{}
}
return rtSigprocmask(how, set, oldset, _C__NSIG/8)
}
/*
* Unimplemented
*/
@ -2426,7 +2436,6 @@ func Setitimer(which ItimerWhich, it Itimerval) (Itimerval, error) {
// RestartSyscall
// RtSigaction
// RtSigpending
// RtSigprocmask
// RtSigqueueinfo
// RtSigreturn
// RtSigsuspend

View File

@ -423,11 +423,15 @@ func Send(s int, buf []byte, flags int) (err error) {
}
func Sendto(fd int, p []byte, flags int, to Sockaddr) (err error) {
ptr, n, err := to.sockaddr()
if err != nil {
return err
var ptr unsafe.Pointer
var salen _Socklen
if to != nil {
ptr, salen, err = to.sockaddr()
if err != nil {
return err
}
}
return sendto(fd, p, flags, ptr, n)
return sendto(fd, p, flags, ptr, salen)
}
func SetsockoptByte(fd, level, opt int, value byte) (err error) {

View File

@ -2151,3 +2151,13 @@ func setitimer(which int, newValue *Itimerval, oldValue *Itimerval) (err error)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func rtSigprocmask(how int, set *Sigset_t, oldset *Sigset_t, sigsetsize uintptr) (err error) {
_, _, e1 := RawSyscall6(SYS_RT_SIGPROCMASK, uintptr(how), uintptr(unsafe.Pointer(set)), uintptr(unsafe.Pointer(oldset)), uintptr(sigsetsize), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}

View File

@ -254,6 +254,12 @@ type Sigset_t struct {
const _C__NSIG = 0x41
const (
SIG_BLOCK = 0x0
SIG_UNBLOCK = 0x1
SIG_SETMASK = 0x2
)
type Siginfo struct {
Signo int32
Errno int32

View File

@ -269,6 +269,12 @@ type Sigset_t struct {
const _C__NSIG = 0x41
const (
SIG_BLOCK = 0x0
SIG_UNBLOCK = 0x1
SIG_SETMASK = 0x2
)
type Siginfo struct {
Signo int32
Errno int32

View File

@ -245,6 +245,12 @@ type Sigset_t struct {
const _C__NSIG = 0x41
const (
SIG_BLOCK = 0x0
SIG_UNBLOCK = 0x1
SIG_SETMASK = 0x2
)
type Siginfo struct {
Signo int32
Errno int32

View File

@ -248,6 +248,12 @@ type Sigset_t struct {
const _C__NSIG = 0x41
const (
SIG_BLOCK = 0x0
SIG_UNBLOCK = 0x1
SIG_SETMASK = 0x2
)
type Siginfo struct {
Signo int32
Errno int32

View File

@ -249,6 +249,12 @@ type Sigset_t struct {
const _C__NSIG = 0x41
const (
SIG_BLOCK = 0x0
SIG_UNBLOCK = 0x1
SIG_SETMASK = 0x2
)
type Siginfo struct {
Signo int32
Errno int32

View File

@ -250,6 +250,12 @@ type Sigset_t struct {
const _C__NSIG = 0x80
const (
SIG_BLOCK = 0x1
SIG_UNBLOCK = 0x2
SIG_SETMASK = 0x3
)
type Siginfo struct {
Signo int32
Code int32

View File

@ -251,6 +251,12 @@ type Sigset_t struct {
const _C__NSIG = 0x80
const (
SIG_BLOCK = 0x1
SIG_UNBLOCK = 0x2
SIG_SETMASK = 0x3
)
type Siginfo struct {
Signo int32
Code int32

View File

@ -251,6 +251,12 @@ type Sigset_t struct {
const _C__NSIG = 0x80
const (
SIG_BLOCK = 0x1
SIG_UNBLOCK = 0x2
SIG_SETMASK = 0x3
)
type Siginfo struct {
Signo int32
Code int32

View File

@ -250,6 +250,12 @@ type Sigset_t struct {
const _C__NSIG = 0x80
const (
SIG_BLOCK = 0x1
SIG_UNBLOCK = 0x2
SIG_SETMASK = 0x3
)
type Siginfo struct {
Signo int32
Code int32

View File

@ -257,6 +257,12 @@ type Sigset_t struct {
const _C__NSIG = 0x41
const (
SIG_BLOCK = 0x0
SIG_UNBLOCK = 0x1
SIG_SETMASK = 0x2
)
type Siginfo struct {
Signo int32
Errno int32

View File

@ -258,6 +258,12 @@ type Sigset_t struct {
const _C__NSIG = 0x41
const (
SIG_BLOCK = 0x0
SIG_UNBLOCK = 0x1
SIG_SETMASK = 0x2
)
type Siginfo struct {
Signo int32
Errno int32

View File

@ -258,6 +258,12 @@ type Sigset_t struct {
const _C__NSIG = 0x41
const (
SIG_BLOCK = 0x0
SIG_UNBLOCK = 0x1
SIG_SETMASK = 0x2
)
type Siginfo struct {
Signo int32
Errno int32

View File

@ -276,6 +276,12 @@ type Sigset_t struct {
const _C__NSIG = 0x41
const (
SIG_BLOCK = 0x0
SIG_UNBLOCK = 0x1
SIG_SETMASK = 0x2
)
type Siginfo struct {
Signo int32
Errno int32

View File

@ -271,6 +271,12 @@ type Sigset_t struct {
const _C__NSIG = 0x41
const (
SIG_BLOCK = 0x0
SIG_UNBLOCK = 0x1
SIG_SETMASK = 0x2
)
type Siginfo struct {
Signo int32
Errno int32

View File

@ -253,6 +253,12 @@ type Sigset_t struct {
const _C__NSIG = 0x41
const (
SIG_BLOCK = 0x1
SIG_UNBLOCK = 0x2
SIG_SETMASK = 0x4
)
type Siginfo struct {
Signo int32
Errno int32

View File

@ -1115,9 +1115,13 @@ func Shutdown(fd Handle, how int) (err error) {
}
func WSASendto(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to Sockaddr, overlapped *Overlapped, croutine *byte) (err error) {
rsa, l, err := to.sockaddr()
if err != nil {
return err
var rsa unsafe.Pointer
var l int32
if to != nil {
rsa, l, err = to.sockaddr()
if err != nil {
return err
}
}
return WSASendTo(s, bufs, bufcnt, sent, flags, (*RawSockaddrAny)(unsafe.Pointer(rsa)), l, overlapped, croutine)
}

4
vendor/modules.txt vendored
View File

@ -172,7 +172,7 @@ github.com/jesseduffield/go-git/v5/utils/merkletrie/filesystem
github.com/jesseduffield/go-git/v5/utils/merkletrie/index
github.com/jesseduffield/go-git/v5/utils/merkletrie/internal/frame
github.com/jesseduffield/go-git/v5/utils/merkletrie/noder
# github.com/jesseduffield/gocui v0.3.1-0.20220922032454-744b0c465c37
# github.com/jesseduffield/gocui v0.3.1-0.20221001154429-72c39318a83d
## explicit; go 1.12
github.com/jesseduffield/gocui
# github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10
@ -291,7 +291,7 @@ golang.org/x/exp/slices
golang.org/x/net/context
golang.org/x/net/internal/socks
golang.org/x/net/proxy
# golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8
# golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec
## explicit; go 1.17
golang.org/x/sys/cpu
golang.org/x/sys/internal/unsafeheader