mirror of
https://github.com/walles/moar.git
synced 2024-08-16 15:30:34 +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
c1641c8456
commit
6325a1cd95
@ -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