Merge pull request #764 from peco/fix-named-returns

remove named return values from Compile and MovePage
This commit is contained in:
lestrrat 2026-02-20 22:31:52 +09:00 committed by GitHub
commit 76f0724099
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View file

@ -168,7 +168,7 @@ func (f *regexpQueryFactory) evictLRU(targetSize int) {
// Compile parses the query string into positive and negative regexp slices,
// caching compiled results for reuse within the expiry threshold.
func (f *regexpQueryFactory) Compile(s string, flags regexpFlags, quotemeta bool) (positive, negative []*regexp.Regexp, err error) {
func (f *regexpQueryFactory) Compile(s string, flags regexpFlags, quotemeta bool) ([]*regexp.Regexp, []*regexp.Regexp, error) {
f.mutex.Lock()
defer f.mutex.Unlock()
@ -184,12 +184,14 @@ func (f *regexpQueryFactory) Compile(s string, flags regexpFlags, quotemeta bool
var posRxs, negRxs []*regexp.Regexp
if len(posTerms) > 0 {
var err error
posRxs, err = termsToRegexps(posTerms, s, flags, quotemeta)
if err != nil {
return nil, nil, fmt.Errorf("failed to compile positive regular expressions: %w", err)
}
}
if len(negTerms) > 0 {
var err error
negRxs, err = termsToRegexps(negTerms, s, flags, quotemeta)
if err != nil {
return nil, nil, fmt.Errorf("failed to compile negative regular expressions: %w", err)

View file

@ -972,14 +972,13 @@ func (l *BasicLayout) linesPerPage() int {
}
// MovePage scrolls the screen
func (l *BasicLayout) MovePage(state *Peco, p hub.PagingRequest) (moved bool) {
func (l *BasicLayout) MovePage(state *Peco, p hub.PagingRequest) bool {
switch p.Type() {
case hub.ToScrollLeft, hub.ToScrollRight:
moved = horizontalScroll(state, l, p)
return horizontalScroll(state, l, p)
default:
moved = verticalScroll(state, l, p)
return verticalScroll(state, l, p)
}
return
}
// computeNewLineNumber calculates the new line number based on the paging