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 anchor #5290

Merged
merged 2 commits into from
Nov 27, 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/).

### Unreleased

### Fixed

- Fixed infinite loop in `Widget.anchor` https://github.com/Textualize/textual/pull/5290

## [0.87.1] - 2024-11-24

## Fixed
Expand Down
6 changes: 2 additions & 4 deletions src/textual/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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."""
Expand Down
Loading