Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Configure PCRE to treat CRLF as a line ending
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbrunsfeld committed Jun 16, 2017
1 parent 66e1c80 commit dc40bb9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions test/native/text-buffer-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,15 @@ TEST_CASE("TextBuffer::find_all") {
}));
}

TEST_CASE("TextBuffer::find_all - CRLF line endings") {
TextBuffer buffer{u"abc\ndef\r\nghi"};
REQUIRE(buffer.find_all(Regex(u"\\w$", nullptr)) == vector<Range>({
Range{Point{0, 2}, Point{0, 3}},
Range{Point{1, 2}, Point{1, 3}},
Range{Point{2, 2}, Point{2, 3}},
}));
}

struct SnapshotData {
Text base_text;
String text;
Expand Down
2 changes: 1 addition & 1 deletion vendor/pcre/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ sure both macros are undefined; an emulation function will then be used. */
at run time. The valid values are 1 (CR), 2 (LF), 3 (CRLF), 4 (ANY), and 5
(ANYCRLF). */
#ifndef NEWLINE_DEFAULT
#define NEWLINE_DEFAULT 2
#define NEWLINE_DEFAULT 4
#endif

/* Name of package */
Expand Down

0 comments on commit dc40bb9

Please # to comment.