1
1
mirror of https://github.com/walles/moar.git synced 2024-09-11 12:15:43 +03:00

Make first line read appear immediately

This commit is contained in:
Johan Walles 2019-07-15 07:08:04 +02:00
parent 2bc8215d59
commit 35429e672b

View File

@ -458,11 +458,15 @@ func (p *_Pager) StartPaging(logger *log.Logger, screen tcell.Screen) {
for {
// Wait for new lines to appear
<-p.reader.moreLinesAdded
screen.PostEvent(tcell.NewEventInterrupt(nil))
// Delay updates a bit so that we don't waste time refreshing
// the screen too often.
//
// Note that the delay is *after* reacting, this way single-line
// updates are reacted to immediately, and the first output line
// read will appear on screen without delay.
time.Sleep(200 * time.Millisecond)
screen.PostEvent(tcell.NewEventInterrupt(nil))
}
}()