FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add HTML entity replacements for tab and space characters by LaurentAerens · Pull Request #7 · dmsnell/diff-match-patch · GitHub

Add HTML entity replacements for tab and space characters - #7

Closed
LaurentAerens wants to merge 3 commits into
dmsnell:mainfrom
LaurentAerens:fix/c-sharp-leading-and-trailing-spaces-and-tabs
Closed

Add HTML entity replacements for tab and space characters#7
LaurentAerens wants to merge 3 commits into
dmsnell:mainfrom
LaurentAerens:fix/c-sharp-leading-and-trailing-spaces-and-tabs

Conversation

LaurentAerens commented Feb 20, 2024
edited
Loading

Copy link
Copy Markdown

diff_prettyHtml currently doesn't highlight leading/trailing space differences. Because spaces in HTML aren't visible.

This pull request changes that.

Instead of

<ins style="background:#e6ffe6;"> </ins>

diff_prettyHtml now returns

<ins style="background:#e6ffe6;">&nbsp;</ins>

resulting in differences with leading/training spaces being visible in HTML.

Example:
When we compare "Test" and "Test " (notice the second string doesn't equal the first string since it has a trailing space).

var diff = dmp.diff_main("Test", "Test "); // this results in the following diff: [[0, 'Test'], [1, ' ']]

Previously looked like this:

Now with this pull requests it looks like this:

Note: this issue also seems to be present in the JavaScript implementation: google#144

Copy link
Copy Markdown
Author

Is there any potential this PR could get a review?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL