Repository navigation
feat: let a host set the tab width, the inline change mode and whitespace hiding - #19
Merged
Merged
Conversation
A corpus of patches, including a new one with tabs, whitespace-only changes, CRLF, wide characters and an interleaved hunk, opened in each layout, with and without wrapping, at four sizes, paged, scrolled and toggled. The digests come from this commit, before any new option, so later changes that alter a default frame fail with the frame printed.
…pace hiding Three display settings for hosts, each with a setter and a getter on Engine, settable before the first file arrives and kept across replace(): - set_tab_width(TabWidth): tabs 1 to 16 cells wide, default 4, everywhere code is measured or drawn, on both split sides. - set_inline_changes(InlineChanges): Word (default), WordAlt, Char and None, named after Pierre's lineDiffType. - set_whitespace(Whitespace): Show (default), IgnoreChange (git diff -b) and IgnoreAll (git diff -w). Removed and added lines of one block that match apart from whitespace are drawn as unchanged; a hunk with no other change shows only its heading. The cursor keeps its line, or goes to the row that shows it now. At their defaults every frame is the same as before, as the recorded default-frames test checks.
backnotprop
force-pushed
the
feat/more-options
branch
from
November 24, 2026 02:01
cc70e6f to
988898e
Compare
…back failed settings - Vertical tab and form feed are not whitespace to git diff -b or -w, so a change to or from them stays a change. - A pair drawn as unchanged reports both line numbers from selected_source in the split layout too, and from a search match's location. - set_tab_width and set_whitespace build everything that can fail first and put the review back if reflowing fails, so the getters always describe what is drawn. - The changelog entries move under a new Unreleased heading above 0.2.3.
App::reveal_source and App::reveal decided whether the cursor's line was on screen from the rows of the last frame, a list reveal_source clears. A second reveal before the next draw, such as a host revealing the first line of a range it just selected, found the list empty and scrolled the line to the bottom of the pane. Both now lay the rows out from the top, as the frame does, so any number of reveals, selections and search jumps between frames leave a line on screen where it is. The screen row a reflow keeps falls back to the same layout when the list is empty.
…what is hidden Unified, a pair drawn as unchanged shows only its added line, but its row took the height of the taller of its two lines, so an old line that wrapped further left empty rows under it. One function, render::drawn_lines, now gives the lines a row draws, and the row's height, its scroll limit and the line the cursor's position is kept by all go by it. Engine::hunk_is_whitespace_only and DiffRow::whitespace_only give the engine's own verdict on what the whitespace setting hides.
sebastianst
pushed a commit
to sebastianst/plannotator-tui
that referenced
this pull request
Nov 24, 2026
…tings (plannotator#197) * feat(review): whitespace, tab width and changed-text settings W (toggle-whitespace) hides changes that only touch whitespace, like git diff -w, and shows them again; a lit 'no ws' chip in the header says when they are hidden. The settings menu gains Whitespace, Tab width and Changed text rows, applied live, remembered with the other choices and settable in [review] (whitespace, tab_width, inline_changes). A selection whose hunk becomes a heading alone is cleared and said so; go to definition opens such a line in the whole file. Bursts of W are taken as one change at the next frame. Also: a remembered-settings file that cannot be read is replaced by the next write or Reset; a config that fails to load is said once in the footer of the review and document screens; going to the only file's heading no longer loops for ever. Uses diffs-rs feat/more-options (plannotator/diffs-rs#19) through [patch.crates-io] until it is published. * fix(review): follow diffs-rs c70c80f, where a form feed or vertical tab is not whitespace The patched diffs crates move to the branch head, which carries 0.2.3. The app's rule for a hunk the viewer hides takes only space, tab, CR and LF as whitespace, as the viewer and git diff -w/-b do, so a change to a form feed stays shown and selectable. * test(review): a drag up with whitespace hidden keeps the view; follow diffs-rs e320ae7 The patched diffs crates move to e320ae7, where a reveal of a line already on screen never scrolls. A Screen test drags up in a scrolled diff with whitespace hidden, tab width 2 and 8, changed text off, split and unified: the view stays, the lines are those dragged over, pairs drawn as unchanged included, and the comment saves their file, side and lines. The wrapped-line comment-box test relied on the reveal that scrolled; it now brings line 30 up with the wheel so the wrapped lines fit under it. * fix(review): ask the viewer which hunks hide as whitespace; W over the file list too The patched diffs crates move to b7ef59d, which says itself whether a hunk is drawn as its heading alone (Engine::hunk_is_whitespace_only). The app's copy of that rule is gone: it read the patch as UTF-8, so a Latin-1 line changed from caf\xe9 to caf\xe8 compared equal, and W cleared a selection on a line still drawn. The app now only finds a line's hunk from the viewer's hunk headings and asks. W hides and shows whitespace over the file list and the notes too, unless the pane gives the key to one of its own; the footer said so already. * build: use published diffs-rs 0.2.4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds three display settings that a host can change while a review is open. Each one has a setter and a getter on
Engine, can be set before the first file arrives, and stays set acrossreplace(). The public API only grows.InlineChangesandWhitespaceare#[non_exhaustive], andTabWidthkeeps its value private.set_tab_width(TabWidth::new(n))TabWidth::DEFAULT(4)set_inline_changes(mode)Word,WordAlt,Char,None(the names of Pierre'slineDiffType)Wordset_whitespace(mode)Show,IgnoreChange(git diff -b),IgnoreAll(git diff -w, GitHub's "Hide whitespace")ShowDefault behaviour
The first commit records digests of every frame the engine draws at its defaults: 5 patches, split, unified and auto layouts, wrap on and off, 4 sizes, and a sequence of moves. It was recorded on
main, before any change. The second commit keeps it passing without re-recording, so every default frame is byte-identical.Tab width
The geometry cache measures tabs at the set width, and changing it clears the cache. Wrapping, horizontal scroll, clicks,
row_at, word emphasis and search highlights all go through the cache, on both split sides. The cursor's line keeps its screen row, as when wrap is toggled.Inline changes
Requestdoes not change.WordAltjoins two word changes when exactly one unchanged grapheme separates them.Charcompares graphemes. If either line has more than 1,000 characters, it compares by word.Noneemphasizes nothing.Whitespace
-b/-wnormalization. It uses the longest common subsequence, keeping the order of both sides. Blocks larger than 4,096 lines pair only their matching start and end.· whitespace only.Limits, also in the
Whitespacerustdoc anddocs/embedding.md:Tests
src/engine/tests/settings.rs(16 tests): unified and split, wrap on and off, ratios 500 and 300,row_at/cursor_rowon every row after each change, an open selection, the cursor on a hidden line, a paired line and a row with no line, bursts of mixed changes, panes down to 30x5, files arriving while whitespace is hidden, and revealed context of checked sources.src/whitespace.rs(-b/-wsemantics, pairing) andsrc/highlight/inline.rs(each mode).tests/default_frames.rsfor the defaults.Performance
Synthetic 3,000-file patches, release build, M-series Mac: