Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app): fix inline_no_clear #5022

Merged
merged 7 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 11 additions & 3 deletions src/textual/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "not not" is a bug. I think the reasoning was that if there are errors (in the exit renderables) they should be printed rather than the last frame.

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:
Expand Down
4 changes: 2 additions & 2 deletions src/textual/drivers/linux_inline_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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[<u") # Disable kitty protocol
self.write("\x1b[J")

if self.attrs_before is not None:
try:
Expand Down
Loading
Loading