Skip to content

feat(tui): clear annotations and wrap wide tables - #72

Open
FireKingY wants to merge 3 commits into
plannotator:mainfrom
FireKingY:feat/clear-current-document-annotations
Open

FireKingY wants to merge 3 commits into
plannotator:mainfrom
FireKingY:feat/clear-current-document-annotations

Conversation

@FireKingY

@FireKingY FireKingY commented Sep 14, 2026

Copy link
Copy Markdown

Summary

  • add C as a document-level clear action in browse mode
  • require y/Enter confirmation, with n/Esc cancellation
  • refresh folder counts and mark the review as changed after clearing
  • reflow wide Markdown tables by cell instead of clipping rendered rows
  • when any cell in a table wraps, add full-width separators across every logical table row
  • document the new behavior and cover both features with regression tests

Motivation

The existing x action removes annotations from the selected block, but there is no efficient way to reset all annotations for the currently open document.

Wide rendered tables were also clipped at the document viewport. The new layout allocates a narrower width to each column, wraps each cell independently, preserves box-drawing borders, and keeps source offsets on the wrapped content. If any cell in a table wraps, the whole table switches to a full grid so every logical row remains visually separated; tables with no wrapping stay compact.

Effect

The fixture uses CJK and wide characters; the comparison below uses ASCII labels so the
GitHub code block itself does not introduce another display-width variable.

Before — the rendered row exceeds the viewport and the right side is clipped:

┌──────────┬──────────────┬────────────────────
│ location │ model        │ conclusion         ...
├──────────┼──────────────┼────────────────────
│ page 1   │ load switch  │ caller creates ...
│ page 2   │ sender       │ output is cut ...

After — columns are fitted, cells wrap independently, and a wrapped table uses a full grid:

┌──────────────┬──────────────┬───────────────┐
│ location     │ model        │ conclusion    │
│              │              │               │
├──────────────┼──────────────┼───────────────┤
│ page 1       │ load switch  │ caller creates│
│              │              │ Group ...     │
├──────────────┼──────────────┼───────────────┤
│ page 2       │ sender       │ no wrap       │
└──────────────┴──────────────┴───────────────┘

Verification

  • cargo fmt --all
  • cargo clippy --workspace --all-targets
  • cargo test --workspace — 126 tests passed
  • cargo build --release -p plannotator-tui

@FireKingY FireKingY changed the title feat(tui): clear all annotations on current document feat(tui): clear annotations and wrap wide tables Sep 14, 2026
@backnotprop

Copy link
Copy Markdown
Contributor

Thanks, both pieces work. Two requests before merge:

  1. Please move the clear-all key from C to X. Lowercase c and Enter both mean "comment on this block", so a shift slip followed by Enter would wipe every note. X pairs with x, which already removes one block's notes.

  2. Please split the table reflow into its own PR. It's a good fix, but it's a rendering change on every wide table and deserves its own review. One note for that PR: the fit gives every column the same width, so short columns get as much room as long ones. Weighting by original width would look a lot better.

Happy to merge the clear-all as soon as it's on X.

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.

2 participants