Skip to content

Whitespace differences not recognisable in diff #281

@Bartvds

Description

@Bartvds

If two string differ on some white space characters this is not visible in the diff, because only the characters are colored. This makes debugging string formatting issues using equality assertions very hard.

Also if you compare two strings on a windows machine and one of the strings has carriage return \r characters blank lines will be inserted between each numbered row of the diff.

edit: we have to apply something like this to get whitespace diff visible:

var debugWhiteSpace = function(str) {
    return str.replace(/\r/g, "\\r").replace(/\n/g, "\\n").replace(/\t/g, "\\t").replace(/ /g, "\\s");
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions