-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip updating initial lines that have not changed #29
Conversation
I'd like to build on this by monitoring the visible rows in the terminal and only including output on those rows. But before I do this -- @sindresorhus is this repo still being maintained? I don't see any recent pushes, and issues haven't seen comments in a long time, either. |
I tested this with Ink and it seems to work OK. |
252b105
to
a01c5ac
Compare
This does, in fact, fail some of the tests I just added, so I'll revisit. |
In many cases, the most frequently-changing part of the logUpdate output is at the bottom, as that is where users expect to see output. This patch optimizes for that case by skipping updating any initial lines that have not changed. For output spanning many lines, this can help avoid unsightly flicker on update.
a01c5ac
to
ac20ece
Compare
Fixed to pass tests. This also works in some manual testing I've done. |
@sindresorhus thoughts on this? If you don't like the direction I'm taking what is admittedly a very simple library, I could fork instead.. |
(as a reminder, since I forgot -- the ❌ is because node 4 is still in |
I'm open to it. Just need to test it against dependents to make sure it doesn't break anything. And I've been out of time lately. I'll get to this one soon. |
In many cases, the most frequently-changing part of the logUpdate output is at the bottom, as that is where users expect to see output. This patch optimizes for that case by skipping updating any initial lines that have not changed. For output spanning many lines, this can help avoid unsightly flicker on update.
I've left the test changes as a separate commit -- they show me that this worked, but if you'd rather not merge those changes then I'm happy to drop that commit. Or squash it.