Skip to content

Commit 7988679

Browse files
authored
Merge pull request #5846 from Textualize/speedups
add speedups
2 parents a3f7b98 + a0b7678 commit 7988679

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88

9+
## Unreleased
10+
11+
### Added
12+
13+
- Added experimental opt-in support for https://github.com/willmcgugan/textual-speedups
14+
915
## [3.3.0] - 2025-06-01
1016

1117
### Fixed

src/textual/_compositor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ def reflow(self, parent: Widget, size: Size) -> ReflowResult:
419419
resized_widgets = {
420420
widget
421421
for widget, (region, *_) in changes
422-
if (widget in common_widgets and old_map[widget].region[2:] != region[2:])
422+
if (widget in common_widgets and old_map[widget].region.size != region.size)
423423
}
424424
return ReflowResult(
425425
hidden=hidden_widgets,

src/textual/geometry.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from __future__ import annotations
77

8+
import os
89
from functools import lru_cache
910
from operator import attrgetter, itemgetter
1011
from typing import (
@@ -1315,6 +1316,13 @@ def grow_maximum(self, other: Spacing) -> Spacing:
13151316
)
13161317

13171318

1319+
if not TYPE_CHECKING and os.environ.get("TEXTUAL_SPEEDUPS") == "1":
1320+
try:
1321+
from textual_speedups import Offset, Region, Size, Spacing
1322+
except ImportError:
1323+
pass
1324+
1325+
13181326
NULL_OFFSET: Final = Offset(0, 0)
13191327
"""An [offset][textual.geometry.Offset] constant for (0, 0)."""
13201328

0 commit comments

Comments
 (0)