Skip to content

feat(core): add setEnableDiffSemanticCleanup and honor fast-diff templates - #74

Open
inchei wants to merge 1 commit into
MrWangJustToDo:mainfrom
inchei:feat/inline-diff-semantic-cleanup-option
Open

inchei wants to merge 1 commit into
MrWangJustToDo:mainfrom
inchei:feat/inline-diff-semantic-cleanup-option

Conversation

@inchei

@inchei inchei commented Sep 20, 2026

Copy link
Copy Markdown

Fixes #73.

Problem

Multiple small insertions on one line (common in CJK text without word boundaries) render as a single highlight block, because diffChanges hardcodes semantic cleanup (fastDiff(a, b, 0, true)), and because render always rebuilds the single-span template even when setEnableFastDiffTemplate(true) is set (so that flag has no visible effect today).

Changes

  • packages/core/src/parse/change-range.ts: new setEnableDiffSemanticCleanup / getEnableDiffSemanticCleanup / resetEnableDiffSemanticCleanup (default true, backward compatible), following the existing config convention in the same file.
  • packages/core/src/parse/template.ts: getPlainDiffTemplate / getSyntaxDiffTemplate keep a prebuilt fast-diff template when setEnableFastDiffTemplate(true) is set; default rendering is untouched.
  • README.md: documented the new flag next to the FastDiff Template section.

Verification

Bundled the modified sources and diffed A、B、C → A[x]、B[y]、C[z]:

  • default flags: single span (unchanged behavior);
  • fast-diff template + cleanup on: merged span, now actually rendered;
  • fast-diff template + cleanup off: three separate [x] / [y] / [z] spans.

eslint and prettier --check pass on the changed files (repo has no test runner).

…lates

Semantic cleanup in diffChanges merged small inline changes into one
block, hiding per-change highlights for text without word boundaries
(e.g. CJK). The cleanup is now opt-out (default on), and prebuilt
fast-diff templates are kept at render time when
setEnableFastDiffTemplate(true) is set.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inline highlight merges multiple small insertions into one block (semantic cleanup), no opt-out

1 participant