Skip to content

views(fix[region]): Track live coordinates - #211

Merged
tony merged 1 commit into
masterfrom
fix/197-live-region-scroll
Dec 5, 2026
Merged

tony merged 1 commit into
masterfrom
fix/197-live-region-scroll

Conversation

@tony

@tony tony commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bind live RegionView instances and nested crops to their Screen and validated contiguous coordinate ranges clipped on every read, removing the stale _live_rows dual shim so retained live regions stay aligned across scroll up/down, DECSTBM, reflow, and resize.
  • Return a shared empty 0-col FrozenRow from live RowView._current_row when vertically out of bounds so shrunk rows never alias recycled _Row instances and cleanly resume when grown back.
  • Canonicalize inverted empty ranges in _slice_indices / _normalize_range and validate range bounds, row_range length, and screen/live bindings across RegionView, RowView, and slice_grid.
  • Resolve current rows in Screen.blit while keeping Snapshot and Snapshot.viewport() regions immutable and isolated.
  • Add comprehensive regression and boundary tests (46/47 diff mutants killed), an executable doctest in docs/topics/snapshots.md, and a CHANGES entry.

Fixes #197

why: Retained live RegionViews held references to mutable _Row objects,
so scrolling reordered rows and reflow replaced backing rows out from
under live regions and nested crops. Out-of-bounds vertically shrunk
live RowViews could also fall back to recycled _Row instances.

what:
- Bind screen-backed RegionView instances and nested crops to Screen
  and validated contiguous coordinate ranges clipped on each read,
  removing the stale _live_rows dual shim.
- Canonicalize empty inverted slice ranges in _slice_indices and
  validate range bounds and screen/live bindings in RegionView,
  RowView, and slice_grid.
- Return a shared empty 0-col FrozenRow from live RowView._current_row
  while vertically out of bounds so shrunk rows never alias recycled
  rows and resume when the screen grows back.
- Resolve current rows in Screen.blit and keep Snapshot and
  Snapshot.viewport regions immutable and isolated.
- Add scroll, reflow, resize, crop-edge wide/grapheme, inverted-slice,
  validation, self-blit, and vertical-shrink regression tests.
- Update docs/topics/snapshots.md (with executable doctest) and CHANGES.

Fixes #197
@tony
tony merged commit 4530d88 into master Dec 5, 2026
9 checks passed
@tony
tony deleted the fix/197-live-region-scroll branch December 5, 2026 17:30
@tony tony mentioned this pull request Dec 5, 2026
35 of 38 tasks

This branch was successfully deployed

1 active deployment
docs — 6863e11c Deployed Dec 5, 2026 by tony via build (3.14) #513
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Retained live regions reorder viewport rows after a scroll

1 participant