This change introduces a debounce mechanism to the cursed renderer's
resize handling. When a resize event occurs, the renderer will now wait
for a short duration before processing the resize. This prevents
multiple full resize renders from occurring in quick succession, which
can lead to performance issues and visual artifacts.
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.
Adds support for terminal mode 2026 sequences and reintroduces cursor
visibility and alt screen management in the Bubble Tea cursed renderer.
The latest changes from the UV renderer drop cursor visibility and alt
screen management. This commit reintroduces that logic into the Bubble
Tea cursed renderer to ensure proper behavior when switching between alt
screen modes and managing cursor visibility.
It also tries to optimize updates and remove redundant state changes.
When rendering to the alternate screen buffer, avoid resizing the screen
buffer to avoid potential rendering issues. The alternate screen buffer
always follows the terminal size, so resizing is unnecessary and can lead
to visual glitches.
Fixes: https://github.com/charmbracelet/crush/issues/1389
This theoretically should improve performance in cases where the view is
not changing between flushes, such as when idle or waiting for input.
However, basic benchmarks do not show a significant difference, so
further investigation may be needed to confirm its effectiveness.