Add word-diffing support#5784
Conversation
Line-level diffs make small in-word edits hard to spot: a one-word change renders as a whole line removed and re-added. Git's `--word-diff=color` highlights the changed words inline instead, which is much easier to read for prose and for dense single-line changes. Model it on the existing `<ctrl+w>` whitespace toggle rather than a per-view binding: it's a global keybinding (`<ctrl+g>`) that flips an in-memory config flag which the diff-building commands (working-tree diff, `git show`, stash show, file diffs) consult when rendering, so it works from any diff without first focusing the main view. The staging and patch-building views are excluded, sharing one unsupported-context list with the whitespace toggle, because word-diff collapses the +/- lines that line-by-line staging depends on. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The main diff view already advertised `(ignoring whitespace)` in its subtitle when that mode was on. Now that word-diff is a second toggle that changes how the same diff is rendered, generalize that single-mode subtitle into one that lists every active option, so `<ctrl+g>` gets the same at-a-glance feedback `<ctrl+w>` has. Rename the whitespace-specific helper to `DiffViewSubtitle` and have it join the active tags (`(ignoring whitespace) (word diff)`); every diff view already routed its subtitle through the one helper, so they all pick up the word-diff tag without further changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
See here for why I don't want this: #5209 (comment) Besides, this project does not accept PRs anyway, see CONTRIBUTING.md. |
|
I see. I'm not familiar with the "different pagers" feature yet, but i will look into it. Do you think it makes sense to ship one or two common |
Personally I don't think so. I find actual pagers vastly superior to |
|
At least we could add the Config example: #4921 (comment) |
|
Makes sense, #5795. |
…lazygit (#5795) Since this frequently comes up as a feature request (but there are reasons why we don't want to add it), explain how to do this in lazygit today. See #5784 (comment).
PR Description
Press ctrl+g to toggle the patch view between show diffs line-wise vs word-wise. Similarly to the ctlr+w ignore-whitespace toggle, the word-diff state is shown alongside the
(ignoring whitespace)status flag.Please check if the PR fulfills these requirements
go generate ./...)This PR is a draft because the PR checklist is incomplete. The main code has undergone human review, but the tests have not.
This PR is potentially a duplicate of: