From a2fc4b1d2e6083cbedff653d2a6618b8c4d7997d Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Wed, 11 Sep 2024 14:22:50 +0100 Subject: [PATCH] Copy on write to Rich log if deferring and content is Text instance --- src/textual/widgets/_rich_log.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/textual/widgets/_rich_log.py b/src/textual/widgets/_rich_log.py index e33a164768..abe77a2237 100644 --- a/src/textual/widgets/_rich_log.py +++ b/src/textual/widgets/_rich_log.py @@ -194,6 +194,8 @@ def write( if not self._size_known: # We don't know the size yet, so we'll need to render this later. # We defer ALL writes until the size is known, to ensure ordering is preserved. + if isinstance(content, Text): + content = content.copy() self._deferred_renders.append( DeferredRender(content, width, expand, shrink, scroll_end) )