Skip to content

snapshot(feat): Locate text by cell coordinates - #133

Merged
tony merged 1 commit into
masterfrom
concept/snapshot-cell-search
Dec 5, 2026
Merged

tony merged 1 commit into
masterfrom
concept/snapshot-cell-search

Conversation

@tony

@tony tony commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add frozen slotted dataclass libvt.snapshot.CellSpan and Snapshot.find_cells(text, /) returning ordered, half-open (row, start, stop) display cell spans across complete stored graphemes in the active viewport (including overlapping matches, explicit trailing spaces, and leading blanks, while skipping wrap spacers and unwritten/BCE trailing padding).
  • Validate text explicitly (TypeError for non-str; ValueError for empty strings or strings containing \r/\n), and keep CellSpan owned solely in libvt.snapshot with no compatibility re-export on libvt.terminal.
  • Add executable NumPy Examples doctests on CellSpan and Snapshot.find_cells, update docs/topics/snapshots.md, docs/project/public-api.md, README.md, and CHANGES, and add comprehensive unit, boundary (?2027h/?2027l, VS16/VS15, RI flags, ambiguous_width=2, cols=1, ?7l, SPACER_HEAD/SPACER_TAIL, BCE, ?2026, CoW), and real-PTY mouse-click tests.

Fixes #102

@tony
tony force-pushed the concept/snapshot-cell-search branch from b387150 to 384d720 Compare December 1, 2026 03:29
tony added a commit that referenced this pull request Dec 3, 2026
why: Record the branch's user-visible change in the unreleased notes.

what:
- Add the #133 entry under What's new in CHANGES
@tony
tony force-pushed the concept/snapshot-cell-search branch from 384d720 to 5f4a47b Compare December 3, 2026 02:53
@tony
tony force-pushed the concept/snapshot-cell-search branch from 5f4a47b to 08adbaf Compare December 3, 2026 23:58
@tony
tony force-pushed the concept/snapshot-cell-search branch from 08adbaf to e9223dd Compare December 5, 2026 14:50
@tony
tony force-pushed the concept/snapshot-cell-search branch from e9223dd to 9e06f49 Compare December 5, 2026 15:06
@tony
tony force-pushed the concept/snapshot-cell-search branch from 9e06f49 to 7763e7b Compare December 5, 2026 15:29
why: String indexing on Snapshot.lines returns code-point offsets
instead of display cell columns, so mouse clicks and cell slices miss
labels preceded by wide glyphs or multi-codepoint graphemes.

what:
- Add frozen dataclass libvt.snapshot.CellSpan and Snapshot.find_cells()
  returning ordered half-open cell spans across complete stored
  graphemes in the active viewport with explicit str type validation.
- Keep CellSpan owned solely in libvt.snapshot with no terminal
  compatibility re-export.
- Add unit, edge-case (wide/grapheme/?2027l/VS16/BCE/cols=1/?2026/CoW),
  doctest, and real-PTY mouse-click tests in tests/test_terminal.py and
  tests/test_aio.py.
- Document CellSpan and Snapshot.find_cells() in
  docs/topics/snapshots.md, docs/project/public-api.md, README.md, and
  CHANGES.

Fixes #102
@tony
tony force-pushed the concept/snapshot-cell-search branch from 7763e7b to 228801e Compare December 5, 2026 17:27
@tony tony changed the title Concept: Find visible text in terminal cell coordinates snapshot(feat): Locate text by cell coordinates Dec 5, 2026
@tony
tony marked this pull request as ready for review December 5, 2026 17:27
@tony
tony merged commit 345b168 into master Dec 5, 2026
9 checks passed
@tony
tony deleted the concept/snapshot-cell-search branch December 5, 2026 17:29
@tony tony mentioned this pull request Dec 5, 2026
35 of 38 tasks

This branch was successfully deployed

1 active deployment
docs — 228801e4 Deployed Dec 5, 2026 by tony via build (3.14) #512
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.

Locate text in a snapshot by terminal row and cell span

1 participant