diff --git a/ren_browser/renderer/micron.py b/ren_browser/renderer/micron.py index 743da6a..dfd6b55 100644 --- a/ren_browser/renderer/micron.py +++ b/ren_browser/renderer/micron.py @@ -565,12 +565,10 @@ def render_micron(content: str, ascii_art_scale: float = 0.75) -> ft.Control: ) text_content = "" - if hasattr(control, "_Text__spans") and control._Text__spans: - text_content = "".join(span.text for span in control._Text__spans) - elif hasattr(control, "_Control__attrs") and "text" in control._Control__attrs: - text_content = control._Control__attrs["text"][0] - elif hasattr(control, "_Control__attrs") and "value" in control._Control__attrs: - text_content = control._Control__attrs["value"][0] + if hasattr(control, "spans") and control.spans: + text_content = "".join(span.text for span in control.spans) + elif hasattr(control, "value") and control.value: + text_content = control.value else: text_content = "" diff --git a/tests/unit/test_renderers.py b/tests/unit/test_renderers.py index cf9a26d..bb19da7 100644 --- a/tests/unit/test_renderers.py +++ b/tests/unit/test_renderers.py @@ -104,8 +104,8 @@ class TestMicronRenderer: for control in result.controls: assert isinstance(control, ft.Text) # Extract text from the merged control - if hasattr(control, "_Control__attrs") and "value" in control._Control__attrs: - all_text += control._Control__attrs["value"][0] + if hasattr(control, "value") and control.value: + all_text += control.value # Should preserve the content assert content in all_text @@ -139,8 +139,8 @@ class TestRendererComparison: for control in micron_result.controls: if isinstance(control, ft.Text): # Extract text from the merged control - if hasattr(control, "_Control__attrs") and "value" in control._Control__attrs: - micron_text += control._Control__attrs["value"][0] + "\n" + if hasattr(control, "value") and control.value: + micron_text += control.value + "\n" # Remove trailing newline and compare micron_text = micron_text.rstrip("\n")