Skip to content

Commit

Permalink
Merge pull request #5296 from Textualize/app-resize-fix
Browse files Browse the repository at this point in the history
force intial resize event
  • Loading branch information
willmcgugan authored Nov 27, 2024
2 parents f3fbf67 + 923686d commit 4e4b4ed
Show file tree
Hide file tree
Showing 5 changed files with 201 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed

- Fixed infinite loop in `Widget.anchor` https://github.com/Textualize/textual/pull/5290
- Fixed delayed App Resize event https://github.com/Textualize/textual/pull/5296

## [0.87.1] - 2024-11-24

Expand Down
3 changes: 3 additions & 0 deletions src/textual/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3067,6 +3067,9 @@ async def invoke_ready_callback() -> None:
try:
try:
await self._dispatch_message(events.Compose())
await self._dispatch_message(
events.Resize.from_dimensions(self.size, None)
)
default_screen = self.screen
self.stylesheet.apply(self)
await self._dispatch_message(events.Mount())
Expand Down
5 changes: 2 additions & 3 deletions src/textual/drivers/linux_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ def _stop_again(*_) -> None:
loop = asyncio.get_running_loop()

def send_size_event() -> None:
if self._in_band_window_resize:
return
terminal_size = self._get_terminal_size()
width, height = terminal_size
textual_size = Size(width, height)
Expand All @@ -231,7 +229,8 @@ def send_size_event() -> None:
self._writer_thread.start()

def on_terminal_resize(signum, stack) -> None:
send_size_event()
if not self._in_band_window_resize:
send_size_event()

signal.signal(signal.SIGWINCH, on_terminal_resize)

Expand Down
Loading

0 comments on commit 4e4b4ed

Please sign in to comment.