markbt / streampager

A pager for command output or large files
MIT License
45 stars 11 forks source link

avoid pessimistic busy render loop #4

Closed wez closed 5 years ago

wez commented 5 years ago

I noticed that running sp < README.md would spin 100% cpu for both sp and my terminal emulator. I ran this down to this bit of code, which would force a full screen render every 100ms.

What seems to work for me is making this only return a Refresh action if there is a pending refresh.

wez commented 5 years ago

To reproduce this, run sp < README.md then press space. The busy loop only kicks in after the first keypress.

markbt commented 5 years ago

Thanks!