Feature Request: Character-Level Diffing Option
Current Behavior Currently, Redlines uses token-level diffing through difflib.SequenceMatcher. When comparing text with small changes (like "dinner" to "dinners"), the entire word is marked as deleted and the new word is inserted, resulting in the entire word being crossed out and rewritten.
Desired Behavior I would like an option for character-level diffing that only highlights the specific characters that changed.
Some examples: Original: "have dinner often." Corrected: "have dinners often." Current output: "have ~~dinner~~ dinners often." Desired output: "have dinners often."
Original: "I want eggs also." Corrected: "I want eggs." Current output: "I want ~~eggs also.~~ eggs." Desired output: "I want eggs ~~also~~."
Note: This feature would only apply to cases where parts of words are added or removed, not both -- when words change completely. For example, in the case of "ourself" → "ourselves", the standard token replacement (crossing out and adding) would still apply. This would make the diff more readable and precise, especially for language learning applications where small grammatical changes are common.
Hi this looks interesting and useful. Do you already have an idea how to implement it (it's not so obvious to me atm)? A PR would be appreciated.
I'm not sure when I'd be able to look into this as it's not in my priority list right now, but I would definitely want to see this feature implemented eventually. If I do implement it myself, I'll submit a PR.
That's all right. I have a few items on my plate as well. Looking forward to your update. In the mean time, I'll consider how to do it as well.