Skip to content

Newlines are not properly compared when using diffWords #140

Closed as not planned
@sdickson

Description

@sdickson

Passing the following 2 strings (in order) into the diffWords function results in some strange results. Some newlines that are added in the second string come back in the array with no "added" indication. This was producing some very strange behavior for our users where newlines would appear 1 word early in the string when we would try to discard all added strings (rather than not appearing at all which is how I would expect it to behave).

Please excuse the bizarre strings - you do what you have to do to stay sane when trying to fix bugs :)

Lastly when testing this please replace the ↵ characters with actual new lines. Probably obvious, but clarifying can't hurt too much.

Board games are better than sportsBoard games are better than sportsBoard games are better than sportsBoard games are better than sportsBoard↵↵games are better than sportsBoard↵↵games are better than sportsBoard games are better than sportsBoard games are better than sportsBoard games are better than sports
Board games are better than sports↵  ↵Board games are better than sportsBoard games are better than sportsBoard games are better than sports↵  ↵Board games are better than sports↵  ↵Board games are better than sports↵  ↵Board games are better than sportsBoard games are better than sportsBoard games are better than sports↵  ↵It's the truth.↵  ↵Except sports board games, those aren't that great.↵  ↵More and more and more pushes↵  ↵4 times is too many

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions