Conversation
umputun
left a comment
There was a problem hiding this comment.
thx for the PR. heads up - #73 by @rashpile is also implementing intra-line highlights. some key differences between the two:
- #73 (+3366/-169, 45 files) has opt-in toggle (
Wkey +--word-diffflag), dedicated theme color keys (WordAddBg/WordRemoveBg), status bar icon, collapsed mode integration, ~94% test coverage, full docs update. usessergi/go-diffas a new dependency - this PR (+374/-10, 6 files) is much smaller footprint, zero new deps (hand-rolled LCS + Levenshtein), cleaner separation in a single file. always-on by design
a few things to address in this approach:
- reuses
SearchBgfor emphasis - when search is active on a highlighted line, intra-line markers and search highlights become indistinguishable. needs separate colors - naive mode threshold 1.0 - when remove/add counts are equal, lines are always paired regardless of similarity. two completely unrelated lines get noisy intra-line highlights
- CI failing - exhaustive switch lint error in
intraline.go:48, missingChangeContext/ChangeDividercases
the small footprint and zero-dependency approach is a real advantage here. the hand-rolled LCS + Levenshtein keeps things self-contained, which I value.
would be great if you and @rashpile could sync up on this - two parallel implementations of the same feature. there might be synergy, e.g. combining the smaller footprint from here with some of the integration work from #73, or joining forces on one PR.
472441f to
8d58941
Compare
|
thx for this. merged a combined version in #87 that takes the core algorithm from this PR:
paired with @rashpile's production integration from #73 (pairing heuristic, 30% similarity gate, dedicated theme colors with HSL auto-derivation, collapsed mode refactor). few changes on top of your implementation:
the final version is always-on matching your design. closing this one as its core algorithm shipped in #87. |
When left and right lines are similar enough, highlight what changed.
Before:

After:
