This simplifies the program's main loop by merging the event handling
and rendering processes. This change reduces complexity and potential
synchronization issues, leading to improved performance and
maintainability.
* fix(renderer): reset kitty keyboard protocol on alt screen switch
We need to reset the kitty keyboard protocol when switching between main
and alt screens. This is because kitty maintains separate keyboard
protocol registries for each screen, and failing to reset the protocol
can lead to issues such as the inability to use the Ctrl key in some
editor that don't support kitty's keyboard protocol.
* chore: update golden files to match the renderer output
When the cursed renderer is stopped and then started again, we need to
restore some state to ensure it functions correctly. This commit
introduces a flag to track when the renderer is starting up again after
being stopped. When this flag is set, we bypass the optimization that
skips rendering if there are no changes, ensuring that the renderer
properly redraws the screen.
One example is when tea.Exec is used to run a program that stops the
renderer and then starts it again. Without this fix, the renderer will
do nothing and print an empty screen until it needs to like when it
receives an update that changes the view.
This change replaces the previous hit testing mechanism with a more
flexible callback function in the View struct. This allows views to
handle messages directly, enabling more customizable behavior that is
not limited to mouse hits.
This change improves the handling of cursor visibility updates and
synchronized output mode in the terminal renderer. It ensures that
cursor visibility changes are only applied when necessary, reducing
flickering and unnecessary terminal control sequences.
Fixes: 55b3503a2a (Merge pull request #1542 from charmbracelet/charm-853-cursor-flash-interruptions-mode-2026)
Since we run the event loop and the render loop in different goroutines,
sometimes they can get out of sync. When a resize happens, the event
loop resizes the screen buffer, however, the render loop may not have
flushed the previous frame yet. This can lead to rendering issues where
the screen buffer is not the correct size for the new frame causing
artifacts.
When synchronized output is not supported or not enabled, we don't
need to wrap updates with cursor hide/show sequences if the cursor
is already hidden.