When hard tabs are enabled, we optimize rendering by using actual tab
characters instead of spaces. This requires us to set tab stops every 8
columns at the beginning of the rendering process.
Fixes: https://github.com/charmbracelet/bubbletea/issues/1614
When the terminal supports it, we now enable Unicode mode (ANSI mode
2027) to ensure accurate width calculation for wide characters and
emojis. This improves rendering fidelity in terminals that support this
mode.
Modified keys (shift+enter, ctrl+i, etc.) don't work in tmux because
tmux doesn't support the Kitty keyboard protocol. tmux requires
applications to request extended-keys using modifyOtherKeys (CSI > 4 ; 2 m).
The workaround is setting 'extended-keys always' in tmux config (tmux 3.2+),
but users may not know this is the issue, and forcing extended-keys for all
applications may not be desired. This fix sends modifyOtherKeys requests
alongside Kitty protocol sequences, enabling proper key handling in tmux
automatically.
This commit modifies the behavior of the `insertAbove` method in the
renderer to execute the insertion of lines immediately rather than
queuing them for later processing. This change ensures that lines are
inserted above the current view without delay.
* 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.
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