mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-24 20:45:56 +03:00
[GH-ISSUE #760] Feature request: word-level (intraline) diff highlighting in <diff> component #979
Labels
No labels
bug
core
documentation
feature
good first issue
help wanted
pull-request
question
react
solid
tmux
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/opentui#979
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @rsbmk on GitHub (Mar 1, 2026).
Original GitHub issue: https://github.com/anomalyco/opentui/issues/760
Summary
The
<diff>component currently highlights changes at the line level only — entire lines are colored as added/removed. Many diff viewers (VS Code, GitHub, lazygit) also highlight the specific words/characters that changed within a line pair, making it much easier to spot small changes in long lines.Use Case
I'm building guit, a terminal git client using OpenTUI + Solid.js. Users expect word-level diff highlighting similar to lazygit or GitHub's diff view.
I initially tried passing
git diff --word-diffto the<diff>component, but--word-diffchanges the output format from standard unified diff — breaking the parser with:The
<diff>component (which usesparsePatchinternally) only accepts standard unified diff format, so there's no way to achieve word-level highlighting with the current API.Proposed Behavior
When enabled (e.g. via a
wordDiff?: booleanprop), the<diff>component would:addedBg/removedBg)Potential new props
Visual Reference
GitHub's diff view is a good reference — full lines are lightly colored, and the specific changed words have a more saturated background:
Environment
@opentui/core+@opentui/solid)@remorses commented on GitHub (Mar 1, 2026):
There's a PR already