未验证 提交 f5898a0e 编写于 作者: C Connor Peet

surround match in zero-width spaces to avoid clobbering

上级 2b9e62fc
......@@ -8,7 +8,7 @@ import * as pathUtils from 'path';
const FILE_LINE_REGEX = /^(\S.*):$/;
const RESULT_LINE_REGEX = /^(\s+)(\d+)(:| )(\s+)(.*)$/;
const ELISION_REGEX = /\.{3}\(([0-9]+) characters skipped\)\.{3}/g;
const ELISION_REGEX = /\.{3}\(\u200b([0-9]+) characters skipped\u200b\)\.{3}/g;
const SEARCH_RESULT_SELECTOR = { language: 'search-result', exclusive: true };
const DIRECTIVES = ['# Query:', '# Flags:', '# Including:', '# Excluding:', '# ContextLines:'];
const FLAGS = ['RegExp', 'CaseSensitive', 'IgnoreExcludeSettings', 'WordMatch'];
......
......@@ -26,8 +26,8 @@ export const SEARCH_EXCLUDE_CONFIG = 'search.exclude';
// Warning: this pattern is used in the search editor to detect offsets. If you
// change this, also change the search-result built-in extension
const SEARCH_ELIDED_PREFIX = '...(';
const SEARCH_ELIDED_SUFFIX = ' characters skipped)...';
const SEARCH_ELIDED_PREFIX = '...(\u200b';
const SEARCH_ELIDED_SUFFIX = ' characters skipped\u200b)...';
const SEARCH_ELIDED_MIN_LEN = (SEARCH_ELIDED_PREFIX.length + SEARCH_ELIDED_SUFFIX.length + 5) * 2;
export const ISearchService = createDecorator<ISearchService>('searchService');
......
......@@ -105,8 +105,8 @@ suite('TextSearchResult', () => {
const range2 = new SearchRange(5, 133, 5, 136);
const range3 = new SearchRange(5, 141, 5, 144);
const result = new TextSearchMatch('foo bar 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 foo bar baz bar', [range1, range2, range3], previewOptions);
assert.deepEqual(result.preview.matches, [new SearchRange(0, 4, 0, 7), new SearchRange(0, 46, 0, 49), new SearchRange(0, 54, 0, 57)]);
assert.equal(result.preview.text, 'foo bar 123456...(117 characters skipped)...o bar baz bar');
assert.deepEqual(result.preview.matches, [new SearchRange(0, 4, 0, 7), new SearchRange(0, 48, 0, 51), new SearchRange(0, 56, 0, 59)]);
assert.equal(result.preview.text, 'foo bar 123456...(\u200b117 characters skipped\u200b)...o bar baz bar');
});
// test('all lines of multiline match', () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册