fix: mascot animation, makes syntax highlighting blink
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user