Handle consecutive char edits in one word#7
Merged
Conversation
|
Tady je mi podezřelé, že se striktně pracuje s jedno-znakovými diffy. Nemůže se stát, že bychom chtěli aby podobné chování bylo i pro 2 znaky? Nebo pro pět? |
Collaborator
Author
|
@machpavel upravila jsem to, aby to bylo konfigurovatelný, tak koukni |
machpavel
approved these changes
Feb 10, 2026
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.
Background
The diff output was highlighting entire words when only a small part of the word changed, which reduced readability and made minor edits look larger than they are. We wanted inline highlighting within a word while keeping existing HTML/tag safety behavior.
Implementation
Implemented inline diffing for a single consecutive span of changes inside a word. The logic finds common prefix/suffix and wraps only the changed span in
<ins>/<del>, with a configurable maximum span length and a fallback to full‑token replacement for non‑eligible cases.Testing
Added unit tests covering inline substitution, insertion, deletion, and multi‑character consecutive span changes, including the max‑length fallback.