Skip to content

feat(review): layout switch, diff settings menu and a draggable split line - #194

Merged
backnotprop merged 9 commits into
mainfrom
feat/review-settings
Nov 24, 2026
Merged

backnotprop merged 9 commits into
mainfrom
feat/review-settings

Conversation

@backnotprop

@backnotprop backnotprop commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What

  • Layout switch.
    • The header shows Split Unified with the layout in force lit, and a Wrap switch.
    • A click does what u or w does; both keys still work.
    • Colours come from ui/chips.rs, with two new rows in its contrast table, dark and light.
  • Diff settings menu.
    • , or the header's Settings button opens it.
    • Rows:
      • Layout (auto/split/unified)
      • Split ratio
      • Wrap
      • Line numbers
      • Colors (auto/dark/light)
      • Background (terminal/theme)
    • Every row shows its value.
    • ↑↓ pick a row, ←→ change it, enter/space move it on (and even the ratio), a click on a row does the same, esc/,/click outside close it.
    • Changes apply live.
  • Draggable middle line. In a split diff:
    • Drag the line between the sides to share the width unevenly (each side keeps 20 columns), or press ( / ).
    • A double click (press and release twice on one cell, as for the pane dividers) evens it.
    • It lights under the pointer and while dragged.
    • A key drops the drag and keeps the ratio reached so far.
    • The drag never moves the cursor, scrolls or selects.
  • Persistence. The app never writes the config file.
    • Defaults < [review] in config.toml (optional, read only, strictly validated) < choices remembered in <data>/clients/plannotator-tui/review-settings.toml.
    • Everything the person does is remembered: the menu, u, w, the header switches, (/), and a drag (on release, to two decimals).
    • Writes contain only the keys this review changed since it last wrote, merged onto the file as it is now. The write goes to a per-process temp file in the same folder, then fsync, then rename. Folders are created.
    • A failed write is said once; the setting holds for the session.
    • The state file is read leniently: bad or unknown keys are skipped and named once, and a file that doesn't parse is ignored.
    • The menu's last row, Reset to defaults, forgets the remembered choices.
    • Older configs and older binaries are unaffected.
  • Narrow header. Priority is switch > Review > Settings > Wrap > key hints. Tested at 60/80/100/120 columns.

diffs-rs

Uses the new split ratio API from plannotator/diffs-rs#17 through a [patch.crates-io] git entry on its branch. No version bump. The patch is to be dropped once diffs-rs is released.

Tests

  • New Screen tests:
    • review/tests/settings_flow.rs:
      • the switch by click and by key, and the wrap switch;
      • the menu changing and remembering every row, Reset, the button and clicks;
      • the next review opening the same way, over [review];
      • config.toml byte-identical (CRLF and comments) after every action;
      • two reviews and a hand edit;
      • a bad state file;
      • an unwritable state file and a missing folder;
      • 60 columns, and the header at 60/80/100/120.
    • review/tests/split_drag.rs:
      • drag with wrap on and off, moving nothing else;
      • a 100-event burst with no draw in between equal to one event per frame;
      • clamp;
      • double click;
      • cancel by key;
      • hover;
      • ( / );
      • selection shading up to the moved line.
  • Unit tests:
    • config/review.rs: compat table, roundtrip, errors.
    • review/settings/state.rs: lenient reading, merge-on-write, Reset, atomic write and failure.
    • review/header.rs: arrangement at every width.
    • keys/tests.rs: older configs that bound ,, (, ).
  • Local results:
    • cargo fmt, cargo clippy --all-targets -- -D warnings and cargo test --workspace pass.
    • The review tests (219) were run 20 times in a loop on a remote Linux machine, at commit 2a56308 (before the persistence rework; one local pass and CI since): 0 failures. Earlier, 10 runs on macOS also passed before that loop was stopped to save disk writes.
    • origin/main (with fix(review): a drag selection no longer races the diff to the bottom #193, the drag-scroll fix) is merged in.

backnotprop and others added 9 commits November 23, 2026 18:53
… line

The header shows Split | Unified (the layout in force lit) and a Wrap switch;
a click does what u and w do. ',' or the header's Settings button opens a menu
of every diff setting the viewer supports: layout, split ratio, wrap, line
numbers, colours and background. Each change applies at once and is written
to [review] in the config file, only the keys that changed, so the next
review opens the same way. In a split diff the line between the sides can be
dragged, moved with ( and ), and evened with a double click; it lights under
the pointer. A narrow header gives way in steps and keeps the switch.

Uses diffs-rs feat/split-ratio through [patch.crates-io] until it is released.
…config file

Choices made in the review (the menu, u, w, the header switches, ( and ),
a drag of the middle line) now go to review-settings.toml in the data folder,
over [review] in the config file, which is read but never written. Only the
keys a review changed are written, onto the file as it is, through a synced
temporary file and a rename, so two reviews and a hand edit keep each other's
choices. A state file with bad keys is read leniently and named once; a
failed write is said once and the setting holds for the session. The menu
gains Reset to defaults. The header keeps Review before Settings and Wrap.
( and ) step by clean twentieths, and a drag is remembered to two decimals.
The theme integration test no longer reads the caller's config.
# Conflicts:
#	crates/plannotator-tui/src/review/draw.rs
#	crates/plannotator-tui/src/review/mod.rs
@backnotprop
backnotprop added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit 5eba4a9 Nov 24, 2026
3 checks passed
@backnotprop
backnotprop deleted the feat/review-settings branch November 24, 2026 01:51
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