summaryrefslogtreecommitdiffstats
path: root/vendor
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-09-25 15:34:15 +1000
committerJesse Duffield <jessedduffield@gmail.com>2023-09-25 16:37:59 +1000
commitc74448f00ddcfc8327bcd4f9d37281015899000f (patch)
treea5c56172c3760d74dee6b51ab87db9630ba1e28b /vendor
parent41ab7c44a06c128c993fc69a6a4b421b5e2e9405 (diff)
Don't select current search result when showing search status
Previously there was no way to render a view's search status without also moving the cursor to the current search match. This caused issues where we wanted to display the status after leaving the view and coming back, or when beginning a new search from within the view. This commit separates the two use cases so we only move the cursor when we're actually selecting the next search match
Diffstat (limited to 'vendor')
-rw-r--r--vendor/github.com/go-errors/errors/README.md1
-rw-r--r--vendor/github.com/go-errors/errors/error_1_13.go26
-rw-r--r--vendor/github.com/go-errors/errors/join_unwrap_1_20.go32
-rw-r--r--vendor/github.com/go-errors/errors/join_unwrap_backward.go71
-rw-r--r--vendor/github.com/jesseduffield/gocui/view.go10
-rw-r--r--vendor/modules.txt4
6 files changed, 112 insertions, 32 deletions
diff --git a/vendor/github.com/go-errors/errors/README.md b/vendor/github.com/go-errors/errors/README.md
index 1ec92329e..558bc883e 100644
--- a/vendor/github.com/go-errors/errors/README.md
+++ b/vendor/github.com/go-errors/errors/README.md
@@ -81,3 +81,4 @@ This package is licensed under the MIT license, see LICENSE.MIT for details.
* v1.4.1 no code change, but now without an unnecessary cover.out file.
* v1.4.2 performance improvement to ErrorStack() to avoid unnecessary work https://github.com/go-errors/errors/pull/40
* v1.5.0 add errors.Join() and errors.Unwrap() copying the stdlib https://github.com/go-errors/errors/pull/40
+* v1.5.1 fix build on go1.13..go1.19 (broken by adding Join and Unwrap with wrong build constraints)
diff --git a/vendor/github.com/go-errors/errors/error_1_13.go b/vendor/github.com/go-errors/errors/error_1_13.go
index 91e709caa..34ab3e00e 100644
--- a/vendor/github.com/go-errors/errors/error_1_13.go
+++ b/vendor/github.com/go-errors/errors/error_1_13.go
@@ -33,29 +33,3 @@ func Is(e error, original error) bool {
return false
}
-
-// Join returns an error that wraps the given errors.
-// Any nil error values are discarded.
-// Join returns nil if every value in errs is nil.
-// The error formats as the concatenation of the strings obtained
-// by calling the Error method of each element of errs, with a newline
-// between each string.
-//
-// A non-nil error returned by Join implements the Unwrap() []error method.
-//
-// For more information see stdlib errors.Join.
-func Join(errs ...error) error {
- return baseErrors.Join(errs...)
-}
-
-// Unwrap returns the result of calling the Unwrap method on err, if err's
-// type contains an Unwrap method returning error.
-// Otherwise, Unwrap returns nil.
-//
-// Unwrap only calls a method of the form "Unwrap() error".
-// In particular Unwrap does not unwrap errors returned by [Join].
-//
-// For more information see stdlib errors.Unwrap.
-func Unwrap(err error) error {
- return baseErrors.Unwrap(err)
-}
diff --git a/vendor/github.com/go-errors/errors/join_unwrap_1_20.go b/vendor/github.com/go-errors/errors/join_unwrap_1_20.go
new file mode 100644
index 000000000..44df35ece
--- /dev/null
+++ b/vendor/github.com/go-errors/errors/join_unwrap_1_20.go
@@ -0,0 +1,32 @@
+//go:build go1.20
+// +build go1.20
+
+package errors
+
+import baseErrors "errors"
+
+// Join returns an error that wraps the given errors.
+// Any nil error values are discarded.
+// Join returns nil if every value in errs is nil.
+// The error formats as the concatenation of the strings obtained
+// by calling the Error method of each element of errs, with a newline
+// between each string.
+//
+// A non-nil error returned by Join implements the Unwrap() []error method.
+//
+// For more information see stdlib errors.Join.
+func Join(errs ...error) error {
+ return baseErrors.Join(errs...)
+}
+
+// Unwrap returns the result of calling the Unwrap method on err, if err's
+// type contains an Unwrap method returning error.
+// Otherwise, Unwrap returns nil.
+//
+// Unwrap only calls a method of the form "Unwrap() error".
+// In particular Unwrap does not unwrap errors returned by [Join].
+//
+// For more information see stdlib errors.Unwrap.
+func Unwrap(err error) error {
+ return baseErrors.Unwrap(err)
+}
diff --git a/vendor/github.com/go-errors/errors/join_unwrap_backward.go b/vendor/github.com/go-errors/errors/join_unwrap_backward.go
new file mode 100644
index 000000000..50c766976
--- /dev/null
+++ b/vendor/github.com/go-errors/errors/join_unwrap_backward.go
@@ -0,0 +1,71 @@
+//go:build !go1.20
+// +build !go1.20
+
+package errors
+
+// Disclaimer: functions Join and Unwrap are copied from the stdlib errors
+// package v1.21.0.
+
+// Join returns an error that wraps the given errors.
+// Any nil error values are discarded.
+// Join returns nil if every value in errs is nil.
+// The error formats as the concatenation of the strings obtained
+// by calling the Error method of each element of errs, with a newline
+// between each string.
+//
+// A non-nil error returned by Join implements the Unwrap() []error method.
+func Join(errs ...error) error {
+ n := 0
+ for _, err := range errs {
+ if err != nil {
+ n++
+ }
+ }
+ if n == 0 {
+ return nil
+ }
+ e := &joinError{
+ errs: make([]error, 0, n),
+ }
+ for _, err := range errs {
+ if err != nil {
+ e.errs = append(e.errs, err)
+ }
+ }
+ return e
+}
+
+type joinError struct {
+ errs []error
+}
+
+func (e *joinError) Error() string {
+ var b []byte
+ for i, err := range e.errs {
+ if i > 0 {
+ b = append(b, '\n')
+ }
+ b = append(b, err.Error()...)
+ }
+ return string(b)
+}
+
+func (e *joinError) Unwrap() []error {
+ return e.errs
+}
+
+// Unwrap returns the result of calling the Unwrap method on err, if err's
+// type contains an Unwrap method returning error.
+// Otherwise, Unwrap returns nil.
+//
+// Unwrap only calls a method of the form "Unwrap() error".
+// In particular Unwrap does not unwrap errors returned by [Join].
+func Unwrap(err error) error {
+ u, ok := err.(interface {
+ Unwrap() error
+ })
+ if !ok {
+ return nil
+ }
+ return u.Unwrap()
+}
diff --git a/vendor/github.com/jesseduffield/gocui/view.go b/vendor/github.com/jesseduffield/gocui/view.go
index 707c32137..c907c1732 100644
--- a/vendor/github.com/jesseduffield/gocui/view.go
+++ b/vendor/github.com/jesseduffield/gocui/view.go
@@ -211,10 +211,6 @@ func (v *View) gotoPreviousMatch() error {
return v.SelectSearchResult(v.searcher.currentSearchIndex)
}
-func (v *View) SelectCurrentSearchResult() error {
- return v.SelectSearchResult(v.searcher.currentSearchIndex)
-}
-
func (v *View) SelectSearchResult(index int) error {
itemCount := len(v.searcher.searchPositions)
if itemCount == 0 {
@@ -225,6 +221,7 @@ func (v *View) SelectSearchResult(index int) error {
}
y := v.searcher.searchPositions[index].y
+
v.FocusPoint(v.ox, y)
if v.searcher.onSelectItem != nil {
return v.searcher.onSelectItem(y, index, itemCount)
@@ -232,6 +229,11 @@ func (v *View) SelectSearchResult(index int) error {
return nil
}
+// Returns <current match index>, <total matches>
+func (v *View) GetSearchStatus() (int, int) {
+ return v.searcher.currentSearchIndex, len(v.searcher.searchPositions)
+}
+
func (v *View) Search(str string) error {
v.writeMutex.Lock()
v.searcher.search(str)
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 82ad517a3..fe2248d26 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -33,7 +33,7 @@ github.com/fsmiamoto/git-todo-parser/todo
# github.com/gdamore/encoding v1.0.0
## explicit; go 1.9
github.com/gdamore/encoding
-# github.com/go-errors/errors v1.5.0
+# github.com/go-errors/errors v1.5.1
## explicit; go 1.14
github.com/go-errors/errors
# github.com/go-git/gcfg v1.5.0
@@ -124,7 +124,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.20230909074155-fc7119a39341
+# github.com/jesseduffield/gocui v0.3.1-0.20230925062444-7cd0d7e2a70a
## explicit; go 1.12
github.com/jesseduffield/gocui
# github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10