From 4b79e88c6680ff1aa9e0971ae34919e2688d55f0 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Tue, 26 Nov 2024 16:36:08 +0000 Subject: [PATCH 1/2] fix anchor --- src/textual/widget.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/textual/widget.py b/src/textual/widget.py index aa2a081645..ffa10f6744 100644 --- a/src/textual/widget.py +++ b/src/textual/widget.py @@ -593,7 +593,7 @@ def opacity(self) -> float: @property def is_anchored(self) -> bool: """Is this widget anchored?""" - return self._parent is not None and self._parent is self + return isinstance(self._parent, Widget) and self._parent._anchored is self @property def is_mouse_over(self) -> bool: @@ -4080,9 +4080,7 @@ async def _on_idle(self, event: events.Idle) -> None: self._check_refresh() if self.is_anchored: - self.scroll_visible(animate=self._anchor_animate) - if self._anchored: - self._anchored.scroll_visible(animate=self._anchor_animate) + self.scroll_visible(animate=self._anchor_animate, immediate=True) def _check_refresh(self) -> None: """Check if a refresh was requested.""" From be1156aebdf1ab0cc0b18e6dc8e3b4522b507316 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Wed, 27 Nov 2024 10:25:07 +0000 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53417a21fd..187c62abe0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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/). +### Unreleased + +### Fixed + +- Fixed infinite loop in `Widget.anchor` https://github.com/Textualize/textual/pull/5290 + ## [0.87.1] - 2024-11-24 ## Fixed