Skip to content

feat(term): implement scrollback search and selection persistence (CTX-0060) - #95

Merged
Xuepoo merged 1 commit into
mainfrom
ctx-0060/feat-scrollback-search
Aug 28, 2026
Merged

Xuepoo merged 1 commit into
mainfrom
ctx-0060/feat-scrollback-search

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Implements scrollback search and selection persistence (CTX-0060).

Summary

  • bitty-term-state/src/search.rs: bounded headless deterministic search over scrollback + live grid (SEARCH_MAX_PATTERN_LEN 256, SEARCH_MAX_RESULTS 1000, ASCII case-insensitive option, bounded heap, pure State -> Vec<SearchMatch>).
  • bitty-ui/src/selection.rs: BufferPos + PersistentSelection buffer-anchored selection persisting across scroll/resize/pruning, line_id-anchored validity (is_valid exact id check), View-aware conversion (from_view_selection / to_view_selection / clamped), deferred snap semantics.
  • bitty-runtime/src/runtime.rs: Runtime::search / search_case_sensitive / persistent_selection / restore_persistent_selection / persistent_selection_text / is_persistent_selection_valid headless wiring.

Review fixes S-1..S-5 (ses_fb793f416 PASS)

  • S-1 stale buffer_row after pruning: is_valid now validates scrollback_line(buffer_row).id == stored_id for line_id Some; text locates via id search and invalidates shift; line_id None remains valid for scrolled history (grid->scrollback).
  • S-2 removed dead column check (width>0 && col>=width).
  • S-3 collapsed duplicate branch in runtime restore_persistent_selection and simplified is_valid else-if.
  • S-4 clamped now only clamps column, snap deferred to resolution (deterministic).
  • S-5 after_full_reset doc corrected to always returns None.

Tests & gates

  • crates/bitty-runtime/tests/scrollback_search_selection_persistence.rs: 9 headless tests covering search, persistence across scroll, pruning invalidation, view offset, resize clamp.
  • cargo check --workspace --all-targets PASS
  • cargo clippy --workspace --all-targets -- -D warnings PASS
  • cargo test --workspace --all-targets PASS (61+39+48+… +9 new)
  • just check 28 files 0 issues (fmt/clippy/test/actionlint/markdownlint)
  • Headless fallback deterministic; no I/O, no wall-clock.

Fixes #94

Refs: CTX-0060
CarryCtx: CTX-0060

…X-0060)

Implements bounded scrollback search in bitty-term-state (SEARCH_MAX_PATTERN_LEN 256, SEARCH_MAX_RESULTS 1000, case-sensitive/insensitive headless deterministic search over scrollback + live grid) and buffer-anchored PersistentSelection in bitty-ui (BufferPos, PersistentSelection with line_id-anchored validity, scroll/resize/prune resilience, View-aware conversion) wired through Runtime search/persistent_selection APIs.

Fixes review S-1 stale buffer_row after pruning (is_valid exact id check, text id-located, line_id None handling), S-2 dead column check, S-3 duplicate branch collapse, S-4 clamped only clamps (snap deferred), S-5 after_full_reset doc.

Adds integration test crates/bitty-runtime/tests/scrollback_search_selection_persistence.rs (9 headless tests) and unit coverage in search.rs; gates: cargo check --workspace --all-targets PASS, cargo clippy -D warnings PASS, cargo test --workspace --all-targets PASS, just check 28 files 0 issues.

Refs: CTX-0060
@Xuepoo
Xuepoo force-pushed the ctx-0060/feat-scrollback-search branch from 1d7866f to fab7938 Compare August 28, 2026 13:18
@Xuepoo
Xuepoo merged commit d005b4d into main Aug 28, 2026
5 checks passed
@Xuepoo
Xuepoo deleted the ctx-0060/feat-scrollback-search branch August 28, 2026 13:26
@Xuepoo Xuepoo added this to the v0.0.1 milestone Aug 29, 2026
@Xuepoo Xuepoo added feat Feature area:term Area: terminal state / VT labels Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:term Area: terminal state / VT feat Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CTX-0060] Implement scrollback search and selection persistence

1 participant