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 non active screen updates #4957

Merged
merged 3 commits into from
Aug 31, 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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.79.1] - 2024-08-31

### Fixed

- Fixed broken updates when non active screen changes https://github.com/Textualize/textual/pull/4957

## [0.79.0] - 2024-08-30

### Added
Expand Down
6 changes: 6 additions & 0 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ Here's what the finished app will look like:
```{.textual path="docs/examples/tutorial/stopwatch.py" title="stopwatch.py" press="tab,enter,tab,enter,tab,enter,tab,enter"}
```

!!! info

Did you notice the `^p palette` at the bottom right hand corner?
This is the [Command Palette](./guide/command_palette.md).
You can think of it as a dedicated command prompt for your app.

### Try it out!

The following is *not* a screenshot, but a fully interactive Textual app running in your browser.
Expand Down
2 changes: 1 addition & 1 deletion examples/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DictionaryApp(App):
CSS_PATH = "dictionary.tcss"

def compose(self) -> ComposeResult:
yield Input(placeholder="Search for a word")
yield Input(placeholder="Search for a word", id="dictionary-search")
with VerticalScroll(id="results-container"):
yield Markdown(id="results")

Expand Down
2 changes: 1 addition & 1 deletion examples/dictionary.tcss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Screen {
background: $panel;
}

Input {
Input#dictionary-search {
dock: top;
margin: 1 0;
}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "textual"
version = "0.79.0"
version = "0.79.1"
homepage = "https://github.com/Textualize/textual"
repository = "https://github.com/Textualize/textual"
documentation = "https://textual.textualize.io/"
Expand Down
4 changes: 3 additions & 1 deletion src/textual/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,8 +935,9 @@ def _compositor_refresh(self) -> None:
elif (
self in self.app._background_screens and self._compositor._dirty_regions
):
# Background screen
self._set_dirty(*self._compositor._dirty_regions)
app.screen.refresh(*self._compositor._dirty_regions)
self._repaint_required = True
self._compositor._dirty_regions.clear()
self._dirty_widgets.clear()
app._update_mouse_over(self)
Expand Down Expand Up @@ -1097,6 +1098,7 @@ async def _on_update(self, message: messages.Update) -> None:
message.prevent_default()
widget = message.widget
assert isinstance(widget, Widget)

self._dirty_widgets.add(widget)
self.check_idle()

Expand Down
8 changes: 6 additions & 2 deletions tests/snapshot_tests/test_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -1460,10 +1460,14 @@ def test_system_commands(snap_compare):

class SimpleApp(App):
def compose(self) -> ComposeResult:
yield Input()
input = Input()
input.cursor_blink = False
yield input

app = SimpleApp()
app.animation_level = "none"
assert snap_compare(
SimpleApp(),
app,
terminal_size=(100, 30),
press=["ctrl+p"],
)
Expand Down
Loading