Skip to content

fix(tui): selection fidelity for two-pane reader (#185 PR5/5)#192

Merged
gerchowl merged 1 commit intodevfrom
land/185-pr5-selection-fidelity
Apr 29, 2026
Merged

fix(tui): selection fidelity for two-pane reader (#185 PR5/5)#192
gerchowl merged 1 commit intodevfrom
land/185-pr5-selection-fidelity

Conversation

@gerchowl
Copy link
Copy Markdown
Contributor

Summary

Closes #185. Last P1 item. Pre-fix, an agent calling `get_current_selection` while the human was browsing highlights in the two-pane reader saw `annotation_id: None` — the human was on something, the agent just couldn't tell.

`current_tui_state` now resolves `annotation_id` from either source:

  • Two-pane reader (`reader=true`): `highlight_focus` over the ROOTS-only list (paper-level notes + replies excluded — they have no body highlight by construction).
  • Single-pane annotation focus (`reader=false`): `annotation_focus` over the FULL list (mixed roots + replies). Pre-existing behaviour kept identical.

Test plan

  • 92/92 `cargo test -p scitadel-tui --lib` pass
  • 4 new tests:
    • reader-mode highlight surfaces correct id
    • reader-mode with no highlight focused → None
    • paper-notes + replies don't shift highlight indices
    • annotation-focus mode unchanged (regression pin)
  • `cargo clippy --tests -- -D warnings` clean
  • `cargo fmt --check` clean

Out of scope

[tape-exempt: TUI-internal selection plumbing; no visible UI change. The fix is observable only via the MCP get_current_selection tool.]

Refs #185 — completes the agent↔human comment loop.

…185 PR5)

Closes the last P1 of #185. Pre-fix, an agent calling
`get_current_selection` while the human was browsing highlights in
the two-pane reader saw `annotation_id: None` — the human *was*
sitting on something, the agent just couldn't tell. Only the
single-pane annotation-focus path was wired.

`current_tui_state` now resolves annotation_id from either source:
- Two-pane reader (`reader=true`): index `highlight_focus` over
  the ROOTS-only list (paper-level notes + replies excluded; they
  don't carry their own anchor and aren't highlight targets).
- Single-pane annotation focus (`reader=false`): index
  `annotation_focus` over the FULL list (mixed roots + replies),
  matching the existing semantics — kept identical so the
  e/d/r-by-row keymap doesn't drift.

4 new tests: reader-mode highlight surfaces correct id, no-focus
surfaces None, paper-notes + replies don't shift the highlight
mapping, annotation-focus mode unchanged.

[tape-exempt: TUI-internal selection plumbing; no visible UI change.
The fix is observable only via the MCP get_current_selection tool,
already covered by tools-side tests in scitadel-mcp.]

Refs #185.
@gerchowl gerchowl merged commit 4f5638c into dev Apr 29, 2026
19 checks passed
@gerchowl gerchowl deleted the land/185-pr5-selection-fidelity branch April 29, 2026 12:45
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.

1 participant