Skip to content
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

Implement smooth scrolling #37

Open
giulianopz opened this issue Jan 28, 2024 · 1 comment
Open

Implement smooth scrolling #37

giulianopz opened this issue Jan 28, 2024 · 1 comment

Comments

@giulianopz
Copy link
Owner

https://flak.tedunangst.com/post/terminal-smooth-scrolling

@giulianopz
Copy link
Owner Author

read here:

The first trick is "overwrite, don't clear". If you clear the "screen" and then add new content, you risk seeing a blank or partially blank frame for a brief moment. It's far better to overwrite the content in the terminal entirely so that there is no intermediate blank frame.

The second trick would be to write new content in a single write to standard output. It may be convenient to make multiple file.write calls to display an update, but as with the blank frame you risk a partial update becoming visible.

The third trick would be to use the Synchronized Output protocol; a relatively new addition to the terminal protocol, but already supported by many terminals. Details in the link, but the gist is that you tell the terminal when you begin and end a frame. It can then use this information to deliver flicker free updates.

With these three tricks in place you can create very smooth animation as long as you can deliver updates at regular intervals. Textual uses 60fps as a baseline. Any more than that probably isn't going to be noticeable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant