Skip to content

#145 breaks line numbering in case of sequential CRs: \n\n is replaced with \n #155

@tophf

Description

@tophf
before #145 after #145
before-fs8 after-fs8

This would work correctly:

replace(/\r\n/g, "\n").replace(/\r/g, "\n")

BTW since both replace() have simple expressions it's 2.5 times faster (Chrome) than currently used (\r|\n){1,2}, you can test it by executing s=prompt(); console.time(1); for(i=0;i<1000;i++) ss=s.replace(/\r\n/g, "\n").replace(/\r/g, "\n"); console.timeEnd(1); in the console (paste something big in the prompt window, for example node-parserlib.js contents. Then compare with the current code's regexp.

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