Skip to content

Handle consecutive char edits in one word#7

Merged
curdopet merged 2 commits into
masterfrom
handle-one-char-edit
Feb 10, 2026
Merged

Handle consecutive char edits in one word#7
curdopet merged 2 commits into
masterfrom
handle-one-char-edit

Conversation

@curdopet
Copy link
Copy Markdown
Collaborator

@curdopet curdopet commented Feb 5, 2026

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.

@machpavel
Copy link
Copy Markdown

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?
Líbilo by se mi kdyby ta změna byla obecná a tedy konfigurovatelná.
Co myslíš - bylo by to hodně práce změnit? Jestli jo, tak nechme tohle - to vyřeší nejvější bolístku :-)

@curdopet curdopet changed the title Handle one char edits Handle consecutive char edits in one word Feb 9, 2026
@curdopet
Copy link
Copy Markdown
Collaborator Author

curdopet commented Feb 9, 2026

@machpavel upravila jsem to, aby to bylo konfigurovatelný, tak koukni

@curdopet curdopet merged commit 2b0f4ad into master Feb 10, 2026
1 check passed
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.

2 participants