feat(render): direct renderer #2

Merged
yves-biener merged 6 commits from non-alternate-screen-rendering into main 2026-01-20 23:15:26 +01:00
Owner

With this renderer you can create TUI applications without the use of the alternate screen, raw mode and re-render the entire application in a line based approach.

In the future partial clearing from the starting position may be possible such that it can behave similarly to how the zig build output is currently written to the terminal (and then removed / replaced).

With this renderer you can create TUI applications without the use of the alternate screen, raw mode and re-render the entire application in a line based approach. In the future partial clearing from the starting position may be possible such that it can behave similarly to how the `zig build` output is currently written to the terminal (and then removed / replaced).
yves-biener added 6 commits 2026-01-20 23:13:43 +01:00
A corresponding example has been added, which is very minimalistic as of now,
but will add further functionality to test the corresponding workflow that is
usual in `zterm` such that it in the best case only a swap in the renderer to
switch from alternate mode drawing to direct drawing.
Handle inputs as per usual (which however is a bit weak, is it goes through
key by key and not the entire line), batch all events such that all events
are handled before the next frame is rendered. For this the `App.start`
function needs to become configurable, such that it changes the termios as
configured (hence it is currently all commented out for testing).
Setting the cursor with the `Direct` handler will cause the rendering
to halt at that point and leave the cursor at point.

Due to not enabling *raw mode* with the newly introduced `App.start`
configuration options corresponding inputs are only visible to `zterm`
once the input has been completed with a newline. With this it is not
necessary for the renderer to know nothing more than the width of the
terminal (which is implied through the `Container` sizes). Making it
very trivial to implement.
The end of the `.line` event received contents is highlighted by a trailing newline
(which cannot occur before, as that triggers the line event itself).

Add signal handler for SIGCONT which forces a `.resize` event that should re-draw the
contents after continuing a suspended application (i.e. ctrl+z followed by `fg`).
feat(inline): rendering without alternate screen
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (pull_request) Successful in 1m10s
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 55s
bfbe75f8d3
Fix issue with growth resize for containers with corresponding
borders, padding and gaps.
yves-biener merged commit bfbe75f8d3 into main 2026-01-20 23:15:26 +01:00
yves-biener deleted branch non-alternate-screen-rendering 2026-01-20 23:15:26 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: yves-biener/zterm#2