From 1f25623da4bdb643807e04b618752762e2b626b3 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Tue, 28 Oct 2025 09:49:16 -0400 Subject: [PATCH] fix(renderer): remove carriage returns from frames This change ensures that carriage return characters are stripped from the output frames before rendering. This prevents potential rendering issues that can arise from the presence of carriage returns, which may interfere with the correct display of the frame content. Fixes: https://github.com/charmbracelet/bubbletea/issues/1520 --- standard_renderer.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/standard_renderer.go b/standard_renderer.go index 969a58c292..6d083cda6e 100644 --- a/standard_renderer.go +++ b/standard_renderer.go @@ -305,6 +305,9 @@ func (r *standardRenderer) write(s string) { defer r.mtx.Unlock() r.buf.Reset() + // Remove carriage returns to avoid messing up rendering. + s = strings.ReplaceAll(s, "\r", "") + // If an empty string was passed we should clear existing output and // rendering nothing. Rather than introduce additional state to manage // this, we render a single space as a simple (albeit less correct)