Skip to content

Commit

Permalink
Merge branch 'main' into sequence-black-hole
Browse files Browse the repository at this point in the history
  • Loading branch information
davep committed Dec 4, 2023
2 parents 4967368 + 07182c3 commit 288a853
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 64 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ 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

### Removed

- Removed renderables/align.py which was no longer used

## [0.44.1] - 2023-12-4

### Fixed

- Fixed slow scrolling when there are many widgets https://github.com/Textualize/textual/pull/3801

## [0.44.0] - 2023-12-1

### Changed
Expand Down Expand Up @@ -1494,6 +1506,7 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040
- New handler system for messages that doesn't require inheritance
- Improved traceback handling

[0.44.1]: https://github.com/Textualize/textual/compare/v0.44.0...v0.44.1
[0.44.0]: https://github.com/Textualize/textual/compare/v0.43.2...v0.44.0
[0.43.2]: https://github.com/Textualize/textual/compare/v0.43.1...v0.43.2
[0.43.1]: https://github.com/Textualize/textual/compare/v0.43.0...v0.43.1
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "textual"
version = "0.44.0"
version = "0.44.1"
homepage = "https://github.com/Textualize/textual"
repository = "https://github.com/Textualize/textual"
documentation = "https://textual.textualize.io/"
Expand Down
17 changes: 10 additions & 7 deletions src/textual/_compositor.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,9 +597,6 @@ def add_widget(
# The region that contains the content (container region minus scrollbars)
child_region = widget._get_scrollable_region(container_region)

# Adjust the clip region accordingly
sub_clip = clip.intersection(child_region)

# The region covered by children relative to parent widget
total_region = child_region.reset_offset

Expand All @@ -609,9 +606,12 @@ def add_widget(
arranged_widgets = arrange_result.widgets
widgets.update(arranged_widgets)

# Get the region that will be updated
sub_clip = clip.intersection(child_region)

if visible_only:
placements = arrange_result.get_visible_placements(
container_size.region + widget.scroll_offset
sub_clip - child_region.offset + widget.scroll_offset
)
else:
placements = arrange_result.placements
Expand All @@ -621,9 +621,9 @@ def add_widget(
placement_offset = container_region.offset
placement_scroll_offset = placement_offset - widget.scroll_offset

_layers = widget.layers
layers_to_index = {
layer_name: index for index, layer_name in enumerate(_layers)
layer_name: index
for index, layer_name in enumerate(widget.layers)
}

get_layer_index = layers_to_index.get
Expand Down Expand Up @@ -661,7 +661,10 @@ def add_widget(

if visible:
# Add any scrollbars
if any(widget.scrollbars_enabled):
if (
widget.show_vertical_scrollbar
or widget.show_horizontal_scrollbar
):
for chrome_widget, chrome_region in widget._arrange_scrollbars(
container_region
):
Expand Down
3 changes: 3 additions & 0 deletions src/textual/_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def get_visible_placements(self, region: Region) -> list[WidgetPlacement]:
Returns:
Set of placements.
"""
if self.total_region in region:
# Short circuit for when we want all the placements
return self.placements
visible_placements = self.spatial_map.get_values_in_region(region)
return visible_placements

Expand Down
56 changes: 0 additions & 56 deletions src/textual/renderables/align.py

This file was deleted.

2 changes: 2 additions & 0 deletions src/textual/scrollbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class ScrollRight(ScrollMessage, verbose=True):
class ScrollTo(ScrollMessage, verbose=True):
"""Message sent when click and dragging handle."""

__slots__ = ["x", "y", "animate"]

def __init__(
self,
x: float | None = None,
Expand Down

0 comments on commit 288a853

Please sign in to comment.