Redraw market without fetch on resize.

master
root 3 years ago
parent cb4d384c5f
commit 69865574e8
  1. 11
      cmd/mop/main.go
  2. 5
      screen.go

@ -60,6 +60,7 @@ func mainLoop(screen *mop.Screen, profile *mop.Profile) {
paused := false
upDownJump := profile.UpDownJump
redrawQuotesFlag := false
redrawMarketFlag := false
go func() {
for {
@ -137,8 +138,12 @@ loop:
case termbox.EventResize:
screen.Resize()
if !showingHelp {
screen.Draw(market)
//screen.Draw(market)
//redrawQuotesFlag = true
//screen.Draw(market)
redrawQuotesFlag = true
redrawMarketFlag = true
//screen.DrawOldQuotes(quotes)
} else {
screen.Draw(help)
}
@ -176,6 +181,10 @@ loop:
screen.DrawOldQuotes(quotes)
redrawQuotesFlag = false
}
if redrawMarketFlag && len(keyboardQueue) == 0 {
screen.Draw(market)
redrawMarketFlag = false
}
}
}

@ -124,6 +124,11 @@ func (screen *Screen) DrawOldQuotes(quotes *Quotes) {
termbox.Flush()
}
func (screen *Screen) DrawOldMarket(market *Market) {
screen.draw(screen.layout.Market(market), false)
termbox.Flush()
}
// Draw accepts variable number of arguments and knows how to display the
// market data, stock quotes, current time, and an arbitrary string.
func (screen *Screen) Draw(objects ...interface{}) *Screen {

Loading…
Cancel
Save