提交 26ce4699 编写于 作者: R Rob Lourens

Fix #25163

上级 e105d5cc
......@@ -152,7 +152,7 @@ export class RipgrepEngine {
}
export class RipgrepParser extends EventEmitter {
private static RESULT_REGEX = /^\u001b\[m(\d+)\u001b\[m:(.*)$/;
private static RESULT_REGEX = /^\u001b\[m(\d+)\u001b\[m:(.*)(\r?)/;
private static FILE_REGEX = /^\u001b\[m(.+)\u001b\[m$/;
public static MATCH_START_MARKER = '\u001b[m\u001b[31m';
......@@ -195,8 +195,17 @@ export class RipgrepParser extends EventEmitter {
let r: RegExpMatchArray;
if (r = outputLine.match(RipgrepParser.RESULT_REGEX)) {
const lineNum = parseInt(r[1]) - 1;
let matchText = r[2];
// workaround https://github.com/BurntSushi/ripgrep/issues/416
// If the match line ended with \r, append a match end marker so the match isn't lost
if (r[3]) {
matchText += RipgrepParser.MATCH_END_MARKER;
}
// Line is a result - add to collected results for the current file path
this.handleMatchLine(outputLine, parseInt(r[1]) - 1, r[2]);
this.handleMatchLine(outputLine, lineNum, matchText);
} else if (r = outputLine.match(RipgrepParser.FILE_REGEX)) {
// Line is a file path - send all collected results for the previous file path
if (this.fileMatch) {
......
......@@ -104,6 +104,16 @@ suite('Search-integration', () => {
doSearchTest(config, 4, done);
});
test('Text: GameOfLife (RegExp to EOL)', function (done: () => void) {
let config = {
rootFolders: rootfolders(),
filePattern: '*.js',
contentPattern: { pattern: 'GameOfLife.*', isRegExp: true }
};
doSearchTest(config, 4, done);
});
test('Text: GameOfLife (Word Match, Case Sensitive)', function (done: () => void) {
let config = {
rootFolders: rootfolders(),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册