mirror of
https://github.com/peco/peco.git
synced 2026-09-10 07:16:29 -04:00
Merge pull request #764 from peco/fix-named-returns
remove named return values from Compile and MovePage
This commit is contained in:
commit
76f0724099
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue