fix: mascot animation, makes syntax highlighting blink

This commit is contained in:
2026-07-30 14:37:39 +02:00
parent 0d2af19c6d
commit 590a863e26
5 changed files with 91 additions and 3 deletions

View File

@@ -49,6 +49,21 @@ func (o *terminalCursorOutput) Write(value []byte) (int, error) {
o.mu.Lock()
defer o.mu.Unlock()
// Bubble Tea v1 can expose intermediate rows from an animated partial
// repaint. This is especially visible when unchanged Markdown code blocks
// below the changed rows contain dense ANSI styling. Terminals that support
// synchronized output hold the completed frame until the reset sequence;
// terminals that do not support it safely ignore both sequences.
if !bytes.Equal(value, []byte(ansi.ShowCursor)) &&
!bytes.Equal(value, []byte(ansi.HideCursor)) {
if _, err := io.WriteString(o.file, ansi.SetSynchronizedOutputMode); err != nil {
return 0, err
}
defer func() {
_, _ = io.WriteString(o.file, ansi.ResetSynchronizedOutputMode)
}()
}
written, err := o.file.Write(value)
if err != nil || written != len(value) {
return written, err