mirror of
https://github.com/walles/moar.git
synced 2024-09-11 12:15:43 +03:00
Wrap interactive search on no hit
This commit is contained in:
parent
21b87eb2d9
commit
01c22cd50b
@ -223,8 +223,6 @@ Execute `release.sh` and follow instructions.
|
||||
|
||||
# TODO
|
||||
|
||||
- Searching for something above us should wrap the search.
|
||||
|
||||
- Enable exiting using ^c (without restoring the screen).
|
||||
|
||||
- Start at a certain line if run as `moar file.txt:42`
|
||||
@ -237,8 +235,6 @@ Execute `release.sh` and follow instructions.
|
||||
- Support viewing multiple files by pushing them in reverse order on the view
|
||||
stack.
|
||||
|
||||
- Incremental search using ^s and ^r like in Emacs
|
||||
|
||||
- Retain the search string when pressing / to search a second time.
|
||||
|
||||
## Done
|
||||
|
@ -13,6 +13,10 @@ func (p *Pager) scrollToSearchHits() {
|
||||
}
|
||||
|
||||
firstHitPosition := p.findFirstHit(*p.scrollPosition.lineNumber(p), false)
|
||||
if firstHitPosition == nil {
|
||||
// Try again from the top
|
||||
firstHitPosition = p.findFirstHit(linenumbers.LineNumber{}, false)
|
||||
}
|
||||
if firstHitPosition == nil {
|
||||
// No match, give up
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user