From d7e91683d14586db17e83427d11a6c92d636925c Mon Sep 17 00:00:00 2001 From: TomJGooding <101601846+TomJGooding@users.noreply.github.com> Date: Thu, 28 Aug 2025 18:41:08 +0100 Subject: [PATCH 1/3] fix(app): fix garbled inline app output Fix garbled inline app output when `inline_no_clear=True`. Currently the terminal cursor isn't actually "reset" before printing the screen contents. This doesn't matter for most inline apps as the cursor is already offset at (0, 0). But if the app contains an `Input` widget, this will update the cursor position so the output will be garbled. Fixes #6064 --- src/textual/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/textual/app.py b/src/textual/app.py index c3b6b5e9a4..7b3ee8d638 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -3294,8 +3294,9 @@ async def invoke_ready_callback() -> None: if self._driver.is_inline: cursor_x, cursor_y = self._previous_cursor_position self._driver.write( - Control.move(-cursor_x, -cursor_y + 1).segment.text + Control.move(-cursor_x, -cursor_y).segment.text ) + self._driver.flush() if inline_no_clear and not self.app._exit_renderables: console = Console() try: From c07054a2e6682bb405991191ba9aa77af8b582b7 Mon Sep 17 00:00:00 2001 From: TomJGooding <101601846+TomJGooding@users.noreply.github.com> Date: Thu, 28 Aug 2025 19:47:56 +0100 Subject: [PATCH 2/3] docs(CHANGELOG): add fix for garbled inline output --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 963e715032..37bf0f4f2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fixed `Content.expand_tabs` https://github.com/Textualize/textual/pull/6038 - Fixed return value for `Pilot.double_click` and `Pilot.triple_click` https://github.com/Textualize/textual/pull/6035 - Fixed sizing issue with `Pretty` widget https://github.com/Textualize/textual/pull/6040 https://github.com/Textualize/textual/pull/6041 +- Fixed garbled inline app output when `inline_no_clear=True` https://github.com/Textualize/textual/pull/6080 ### Added From 4474bbf67b334ef03334a5b8311b15e882590435 Mon Sep 17 00:00:00 2001 From: TomJGooding <101601846+TomJGooding@users.noreply.github.com> Date: Fri, 29 Aug 2025 14:59:51 +0100 Subject: [PATCH 3/3] fix(app): restore prompt correctly when inline app exits Following the fix for garbled inline app outputs in d7e9168, update the other terminal cursor move accordingly to correctly restore the prompt. --- src/textual/app.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/textual/app.py b/src/textual/app.py index 7b3ee8d638..f088bab1b9 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -3305,9 +3305,7 @@ async def invoke_ready_callback() -> None: console.print() else: self._driver.write( - Control.move( - -cursor_x, -self.INLINE_PADDING - 1 - ).segment.text + Control.move(0, -self.INLINE_PADDING).segment.text ) driver.stop_application_mode()