Bump gocui
This updates gocui to include https://github.com/jesseduffield/gocui/pull/68 and https://github.com/jesseduffield/gocui/pull/69, which changes views to not have an extra blank line at the end when content ending in a newline character is written to them. This makes text views more consistent with list views, which don't have a blank line after the last list entry either.
This commit is contained in:
78
vendor/github.com/jesseduffield/gocui/view.go
generated
vendored
78
vendor/github.com/jesseduffield/gocui/view.go
generated
vendored
@@ -66,6 +66,11 @@ type View struct {
|
||||
// true and viewLines to nil
|
||||
viewLines []viewLine
|
||||
|
||||
// If the last character written was a newline, we don't write it but
|
||||
// instead set pendingNewline to true. If more text is written, we write the
|
||||
// newline then. This is to avoid having an extra blank at the end of the view.
|
||||
pendingNewline bool
|
||||
|
||||
// writeMutex protects locks the write process
|
||||
writeMutex sync.Mutex
|
||||
|
||||
@@ -647,6 +652,9 @@ func (v *View) SetWritePos(x, y int) {
|
||||
|
||||
v.wx = x
|
||||
v.wy = y
|
||||
|
||||
// Changing the write position makes a pending newline obsolete
|
||||
v.pendingNewline = false
|
||||
}
|
||||
|
||||
// WritePos returns the current write position of the view's internal buffer.
|
||||
@@ -690,7 +698,7 @@ func (v *View) makeWriteable(x, y int) {
|
||||
v.lines = append(v.lines, nil)
|
||||
}
|
||||
}
|
||||
// cell `x` must not be index-able (that's why `<`)
|
||||
// cell `x` need not be index-able (that's why `<`)
|
||||
// append should be used by `lines[y]` user if he wants to write beyond `x`
|
||||
for len(v.lines[y]) < x {
|
||||
if cap(v.lines[y]) > len(v.lines[y]) {
|
||||
@@ -726,14 +734,6 @@ 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
|
||||
@@ -762,31 +762,43 @@ func (v *View) writeRunes(p []rune) {
|
||||
// Fill with empty cells, if writing outside current view buffer
|
||||
v.makeWriteable(v.wx, v.wy)
|
||||
|
||||
for _, r := range p {
|
||||
finishLine := func() {
|
||||
v.autoRenderHyperlinksInCurrentLine()
|
||||
if v.wx >= len(v.lines[v.wy]) {
|
||||
v.writeCells(v.wx, v.wy, []cell{{
|
||||
chr: 0,
|
||||
fgColor: 0,
|
||||
bgColor: 0,
|
||||
}})
|
||||
}
|
||||
}
|
||||
|
||||
advanceToNextLine := func() {
|
||||
v.wx = 0
|
||||
v.wy++
|
||||
if v.wy >= len(v.lines) {
|
||||
v.lines = append(v.lines, nil)
|
||||
}
|
||||
}
|
||||
|
||||
if v.pendingNewline {
|
||||
advanceToNextLine()
|
||||
v.pendingNewline = false
|
||||
}
|
||||
|
||||
until := len(p)
|
||||
if until > 0 && p[until-1] == '\n' {
|
||||
v.pendingNewline = true
|
||||
until--
|
||||
}
|
||||
|
||||
for _, r := range p[:until] {
|
||||
switch r {
|
||||
case '\n':
|
||||
v.autoRenderHyperlinksInCurrentLine()
|
||||
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)
|
||||
}
|
||||
finishLine()
|
||||
advanceToNextLine()
|
||||
case '\r':
|
||||
v.autoRenderHyperlinksInCurrentLine()
|
||||
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,
|
||||
}})
|
||||
}
|
||||
finishLine()
|
||||
v.wx = 0
|
||||
default:
|
||||
truncateLine, cells := v.parseInput(r, v.wx, v.wy)
|
||||
@@ -803,6 +815,10 @@ func (v *View) writeRunes(p []rune) {
|
||||
}
|
||||
}
|
||||
|
||||
if v.pendingNewline {
|
||||
finishLine()
|
||||
}
|
||||
|
||||
v.updateSearchPositions()
|
||||
}
|
||||
|
||||
|
||||
12
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
generated
vendored
12
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
generated
vendored
@@ -246,6 +246,18 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
func Dup3(oldfd, newfd, flags int) error {
|
||||
if oldfd == newfd || flags&^O_CLOEXEC != 0 {
|
||||
return EINVAL
|
||||
}
|
||||
how := F_DUP2FD
|
||||
if flags&O_CLOEXEC != 0 {
|
||||
how = F_DUP2FD_CLOEXEC
|
||||
}
|
||||
_, err := fcntl(oldfd, how, newfd)
|
||||
return err
|
||||
}
|
||||
|
||||
/*
|
||||
* Exposed directly
|
||||
*/
|
||||
|
||||
11
vendor/golang.org/x/sys/windows/dll_windows.go
generated
vendored
11
vendor/golang.org/x/sys/windows/dll_windows.go
generated
vendored
@@ -43,8 +43,8 @@ type DLL struct {
|
||||
// LoadDLL loads DLL file into memory.
|
||||
//
|
||||
// Warning: using LoadDLL without an absolute path name is subject to
|
||||
// DLL preloading attacks. To safely load a system DLL, use LazyDLL
|
||||
// with System set to true, or use LoadLibraryEx directly.
|
||||
// DLL preloading attacks. To safely load a system DLL, use [NewLazySystemDLL],
|
||||
// or use [LoadLibraryEx] directly.
|
||||
func LoadDLL(name string) (dll *DLL, err error) {
|
||||
namep, err := UTF16PtrFromString(name)
|
||||
if err != nil {
|
||||
@@ -271,6 +271,9 @@ func (d *LazyDLL) NewProc(name string) *LazyProc {
|
||||
}
|
||||
|
||||
// NewLazyDLL creates new LazyDLL associated with DLL file.
|
||||
//
|
||||
// Warning: using NewLazyDLL without an absolute path name is subject to
|
||||
// DLL preloading attacks. To safely load a system DLL, use [NewLazySystemDLL].
|
||||
func NewLazyDLL(name string) *LazyDLL {
|
||||
return &LazyDLL{Name: name}
|
||||
}
|
||||
@@ -410,7 +413,3 @@ func loadLibraryEx(name string, system bool) (*DLL, error) {
|
||||
}
|
||||
return &DLL{Name: name, Handle: h}, nil
|
||||
}
|
||||
|
||||
type errString string
|
||||
|
||||
func (s errString) Error() string { return string(s) }
|
||||
|
||||
6
vendor/modules.txt
vendored
6
vendor/modules.txt
vendored
@@ -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.20241223111608-9967d0e928a0
|
||||
# github.com/jesseduffield/gocui v0.3.1-0.20250106080306-164661a92088
|
||||
## explicit; go 1.12
|
||||
github.com/jesseduffield/gocui
|
||||
# github.com/jesseduffield/kill v0.0.0-20250101124109-e216ddbe133a
|
||||
@@ -314,13 +314,13 @@ golang.org/x/net/proxy
|
||||
# golang.org/x/sync v0.10.0
|
||||
## explicit; go 1.18
|
||||
golang.org/x/sync/errgroup
|
||||
# golang.org/x/sys v0.28.0
|
||||
# golang.org/x/sys v0.29.0
|
||||
## explicit; go 1.18
|
||||
golang.org/x/sys/cpu
|
||||
golang.org/x/sys/plan9
|
||||
golang.org/x/sys/unix
|
||||
golang.org/x/sys/windows
|
||||
# golang.org/x/term v0.27.0
|
||||
# golang.org/x/term v0.28.0
|
||||
## explicit; go 1.18
|
||||
golang.org/x/term
|
||||
# golang.org/x/text v0.21.0
|
||||
|
||||
Reference in New Issue
Block a user