diff --git a/CHANGELOG.md b/CHANGELOG.md index cb52627175..8a25970f27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fixed flicker when setting `dark` reactive on startup https://github.com/Textualize/textual/pull/4989 - Fixed command palette not sorting search results by their match score https://github.com/Textualize/textual/pull/4994 - Fixed `DataTable` cached height issue on re-populating the table when using auto-height rows https://github.com/Textualize/textual/pull/4992 +- Fixed inline app output being cleared when `inline_no_clear=True` https://github.com/Textualize/textual/issues/5019 ## [0.79.1] - 2024-08-31 diff --git a/src/textual/app.py b/src/textual/app.py index e612e25675..9a6267bc3f 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -2959,10 +2959,18 @@ async def invoke_ready_callback() -> None: self._driver.write( Control.move(-cursor_x, -cursor_y + 1).segment.text ) - if inline_no_clear and not not self.app._exit_renderables: + if inline_no_clear and not self.app._exit_renderables: console = Console() - console.print(self.screen._compositor) - console.print() + try: + console.print(self.screen._compositor) + except ScreenStackError: + console.print() + else: + self._driver.write( + Control.move( + -cursor_x, -self.INLINE_PADDING - 1 + ).segment.text + ) driver.stop_application_mode() except Exception as error: diff --git a/src/textual/drivers/linux_inline_driver.py b/src/textual/drivers/linux_inline_driver.py index 734bbb3445..c12eb3219f 100644 --- a/src/textual/drivers/linux_inline_driver.py +++ b/src/textual/drivers/linux_inline_driver.py @@ -310,8 +310,8 @@ def stop_application_mode(self) -> None: """Stop application mode, restore state.""" self._disable_bracketed_paste() self.disable_input() - - self.write("\x1b[2A\x1b[J") + self.write("\x1b[ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - DisabledApp + DisabledApp - + - - Labels don't have a disabled state                                               -I am disabled                                                                  - - - -I am disabled                                                                  - - - - Foo   Bar       - Also  disabled  - - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -you                                                                        -can't                                                                      -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -X Simple SelectionList                                                     - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - - + + Labels don't have a disabled state                                               +I am disabled                                                                  + + + +I am disabled                                                                  + + + + Foo   Bar       + Also  disabled  + + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +you                                                                        +can't                                                                      +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +X Simple SelectionList                                                     + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + +