Repository navigation
tui: draw the screen with the kitty graphics protocol - #10
Merged
Merged
Conversation
The setting renderer = "kitty" draws each line of the screen as a picture over the text that Bubble Tea draws. A line that changes gets a new picture, which replaces the old one at once in a synchronized update, so the screen does not flicker. Box lines and blocks are drawn as shapes, so they join the next cells with no gap. The keys, the mouse, and the text of the pane work as before: the text is still there, under the pictures. A line keeps its picture while it scrolls, so a scroll sends only the lines that come into view. Bubble Tea scrolls the text with scroll regions, and the terminal moves the pictures with it, so each frame with a change places every row again. A placement with the same image and placement ID moves to where it is placed. The pictures go after the text of their frame, so a clear of the screen in the text cannot delete them. Before Bubble Tea leaves the alternate screen, to quit or to run an editor, the pictures are deleted, or they would cover the shell. The terminal answers the questions for its colours one by one; the screen waits until they settle and draws once, not once for each answer. A frame that waits for a slow terminal does not stop the program, so q still quits. The pictures are RGBA compressed with zlib, which is a few times faster than PNG. The buffers, the compressors, and the cells of the screen are reused from frame to frame, and a frame that changes nothing sends nothing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The setting renderer = "kitty" draws each line of the screen as a picture over the text that Bubble Tea draws. A line that changes gets a new picture, which replaces the old one at once in a synchronized update, so the screen does not flicker. Box lines and blocks are drawn as shapes, so they join the next cells with no gap. The keys, the mouse, and the text of the pane work as before: the text is still there, under the pictures.
A line keeps its picture while it scrolls, so a scroll sends only the lines that come into view. Bubble Tea scrolls the text with scroll regions, and the terminal moves the pictures with it, so each frame with a change places every row again. A placement with the same image and placement ID moves to where it is placed.
The pictures go after the text of their frame, so a clear of the screen in the text cannot delete them. Before Bubble Tea leaves the alternate screen, to quit or to run an editor, the pictures are deleted, or they would cover the shell. The terminal answers the questions for its colours one by one; the screen waits until they settle and draws once, not once for each answer. A frame that waits for a slow terminal does not stop the program, so q still quits.
The pictures are RGBA compressed with zlib, which is a few times faster than PNG. The buffers, the compressors, and the cells of the screen are reused from frame to frame, and a frame that changes nothing sends nothing.