Skip to content

Commit

Permalink
Make it clear, in the code, that all containers are considered scroll…
Browse files Browse the repository at this point in the history
…able

The code is exactly the same between is_container and is_scrollable, and the
intent (confirmed in
Textualize#1343 (comment))
is that the latter is intended to be overridden in some circumstances (so
far only in `ScrollView`). As such I feel it better conveys intent and
reduces the changes of mismatched future changes if is_scrollable is defined
in respect to is_container.

The only possible reason I can think of is if there's a measurable
performance win here. Applying Knuth for the moment, at least for the scope
of this PR. I strongly suspect this is one of the 97% rather than one of the
3% and for the purposes of moving stuff around (which I may be doing as I
explore this) I believe this makes it easier to follow and to think about.
  • Loading branch information
davep committed Dec 13, 2022
1 parent b48acc0 commit d92c252
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/textual/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ def is_scrollable(self) -> bool:
Returns:
bool: True if this widget may be scrolled.
"""
return self.styles.layout is not None or bool(self.children)
return self.is_container

@property
def layer(self) -> str:
Expand Down

0 comments on commit d92c252

Please sign in to comment.