mirror of
https://github.com/walles/moar.git
synced 2024-09-11 12:15:43 +03:00
WIP: Go to the line with the search hit
Some warnings, we should at least be using scrollPosition.isVisible().
This commit is contained in:
parent
89955fa0e6
commit
f0e11a4e0e
@ -445,6 +445,9 @@ func (p *Pager) StartPaging(screen twin.Screen, chromaStyle *chroma.Style, chrom
|
||||
case twin.EventTerminalBackgroundDetected:
|
||||
// Do nothing, we don't care about background color updates
|
||||
|
||||
case eventGoToLine:
|
||||
p.scrollPosition = NewScrollPositionFromLineNumber(event.lineNumber, "goToLine")
|
||||
|
||||
default:
|
||||
log.Warnf("Unhandled event type: %v", event)
|
||||
}
|
||||
|
@ -18,6 +18,10 @@ const (
|
||||
searchCommandDone
|
||||
)
|
||||
|
||||
type eventGoToLine struct {
|
||||
lineNumber linenumbers.LineNumber
|
||||
}
|
||||
|
||||
type PagerModeSearch struct {
|
||||
pager *Pager
|
||||
|
||||
@ -83,7 +87,7 @@ func (m *PagerModeSearch) initSearcher() {
|
||||
case searchCommandSearch:
|
||||
found := m.searcherSearch()
|
||||
if found != nil {
|
||||
FIXME: Tell the pager to scroll to this position
|
||||
m.pager.screen.Events() <- eventGoToLine{*found}
|
||||
}
|
||||
case searchCommandDone:
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user