Repository navigation
feat(review): hide whitespace changes, tab width and changed-text settings - #197
Merged
Merged
Conversation
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.
…ab 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.
… 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.
…e 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.
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 diff settings to the code review, plus a key and a header chip for the whitespace one.
Settings (menu rows, live; remembered in the review settings file; settable in
[review]):[review]key and valueswhitespace = "show" | "ignore-all" | "ignore-change"tab_width = 1..=16(default 4; the menu steps from any value to its neighbours among 2/4/8)inline_changes = "word" | "word-alt" | "char" | "none"W(toggle-whitespace) hides or shows whitespace-only changes, over the diff, the file list or the notes. It is in the late group, so a user binding that already usesWkeeps it. It is listed in?help. While whitespace is hidden, a lit amberno wschip sits beside Wrap; clicking it shows whitespace again. The chip's colours are in the chips contrast table.+/−counts stay the patch's counts.[review]values fail like the existing keys. Bad values in the remembered file are skipped and named once.Behaviour while whitespace is hidden
vstill stay inside one hunk.Wand,go into the draft.Wpresses is applied once, at the next frame: 50 presses draw the same frame as none.Also in this PR
config not loaded: <reason>; using defaults (<path>)once in the footer, and keep using the defaults.Upat the top as a redraw.Dependency: uses diffs-rs
feat/more-options(plannotator/diffs-rs#19) through[patch.crates-io](diffs-rs, diffs-syntect, diffs-two-face). The crate requirement is0.2.3, the version that branch carries (head b7ef59d). Swap both for the published release before merging.Tests:
review/tests/whitespace_flow.rs(drives the real Screen), plus additions to config/review.rs, settings/state.rs, keys/tests.rs, header.rs, diff/whitespace.rs, settings_flow.rs, file_list.rs, config.rs and app/tests.rs.