mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Make it clear, in the code, that all containers are considered scrollable
The code is exactly the same between is_container and is_scrollable, and the intent (confirmed in https://github.com/Textualize/textual/issues/1343#issuecomment-1347989752) 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.
This commit is contained in:
@@ -1227,7 +1227,7 @@ class Widget(DOMNode):
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user