提交 b8df0a3f 编写于 作者: A Alex Dima

Fixes #5887: Remove limit for "Change/Select All Occurrences"

上级 c43a3fa2
...@@ -25,6 +25,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag ...@@ -25,6 +25,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
import { ModelDecorationOptions } from 'vs/editor/common/model/textModelWithDecorations'; import { ModelDecorationOptions } from 'vs/editor/common/model/textModelWithDecorations';
import { overviewRulerSelectionHighlightForeground } from 'vs/platform/theme/common/colorRegistry'; import { overviewRulerSelectionHighlightForeground } from 'vs/platform/theme/common/colorRegistry';
import { themeColorFromId } from 'vs/platform/theme/common/themeService'; import { themeColorFromId } from 'vs/platform/theme/common/themeService';
import { Constants } from 'vs/editor/common/core/uint';
export const enum FindStartFocusAction { export const enum FindStartFocusAction {
NoFocusChange, NoFocusChange,
...@@ -801,21 +802,21 @@ export class MoveSelectionToPreviousFindMatchAction extends SelectPreviousFindMa ...@@ -801,21 +802,21 @@ export class MoveSelectionToPreviousFindMatchAction extends SelectPreviousFindMa
export abstract class AbstractSelectHighlightsAction extends EditorAction { export abstract class AbstractSelectHighlightsAction extends EditorAction {
public run(accessor: ServicesAccessor, editor: editorCommon.ICommonCodeEditor): void { public run(accessor: ServicesAccessor, editor: editorCommon.ICommonCodeEditor): void {
let controller = CommonFindController.get(editor); const controller = CommonFindController.get(editor);
if (!controller) { if (!controller) {
return null; return null;
} }
let matches: Range[] = null; let matches: editorCommon.FindMatch[] = null;
const findState = controller.getState(); const findState = controller.getState();
if (findState.isRevealed && findState.isRegex && findState.searchString.length > 0) { if (findState.isRevealed && findState.isRegex && findState.searchString.length > 0) {
matches = editor.getModel().findMatches(findState.searchString, true, findState.isRegex, findState.matchCase, findState.wholeWord ? editor.getConfiguration().wordSeparators : null, false).map(m => m.range); matches = editor.getModel().findMatches(findState.searchString, true, findState.isRegex, findState.matchCase, findState.wholeWord ? editor.getConfiguration().wordSeparators : null, false, Constants.MAX_SAFE_SMALL_INTEGER);
} else { } else {
let r = multiCursorFind(editor, { const r = multiCursorFind(editor, {
changeFindSearchString: true, changeFindSearchString: true,
allowMultiline: true, allowMultiline: true,
highlightFindOptions: true highlightFindOptions: true
...@@ -824,14 +825,14 @@ export abstract class AbstractSelectHighlightsAction extends EditorAction { ...@@ -824,14 +825,14 @@ export abstract class AbstractSelectHighlightsAction extends EditorAction {
return; return;
} }
matches = editor.getModel().findMatches(r.searchText, true, false, r.matchCase, r.wholeWord ? editor.getConfiguration().wordSeparators : null, false).map(m => m.range); matches = editor.getModel().findMatches(r.searchText, true, false, r.matchCase, r.wholeWord ? editor.getConfiguration().wordSeparators : null, false, Constants.MAX_SAFE_SMALL_INTEGER);
} }
if (matches.length > 0) { if (matches.length > 0) {
let editorSelection = editor.getSelection(); const editorSelection = editor.getSelection();
for (let i = 0, len = matches.length; i < len; i++) { for (let i = 0, len = matches.length; i < len; i++) {
let match = matches[i]; const match = matches[i];
let intersection = match.intersectRanges(editorSelection); let intersection = match.range.intersectRanges(editorSelection);
if (intersection) { if (intersection) {
// bingo! // bingo!
matches.splice(i, 1); matches.splice(i, 1);
...@@ -839,7 +840,7 @@ export abstract class AbstractSelectHighlightsAction extends EditorAction { ...@@ -839,7 +840,7 @@ export abstract class AbstractSelectHighlightsAction extends EditorAction {
break; break;
} }
} }
editor.setSelections(matches.map(m => new Selection(m.startLineNumber, m.startColumn, m.endLineNumber, m.endColumn))); editor.setSelections(matches.map(m => new Selection(m.range.startLineNumber, m.range.startColumn, m.range.endLineNumber, m.range.endColumn)));
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册