mirror of
https://github.com/walles/moar.git
synced 2024-09-11 12:15:43 +03:00
Handle new lines arriving
We display the lines, but we also just freeze. Try "./moar.sh moar.sh" and try to search and you'll see.
This commit is contained in:
parent
106626388d
commit
447da01d49
15
m/pager.go
15
m/pager.go
@ -453,6 +453,21 @@ func (p *_Pager) StartPaging(logger *log.Logger, screen tcell.Screen) {
|
||||
screen.Show()
|
||||
p._Redraw(logger)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
// Wait for new lines to appear
|
||||
<-p.reader.moreLinesAdded
|
||||
|
||||
// Request refresh
|
||||
//
|
||||
// FIXME: What we want to do here really is request a refresh in
|
||||
// 0.2s. If a refresh is already pending, do nothing. This way
|
||||
// we'll be able to respond to more lines read, while not having
|
||||
// to refresh the screen too many times for long files.
|
||||
screen.PostEvent(tcell.NewEventInterrupt(nil))
|
||||
}
|
||||
}()
|
||||
|
||||
// Main loop
|
||||
for !p.quit {
|
||||
ev := screen.PollEvent()
|
||||
|
Loading…
Reference in New Issue
Block a user