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

Fixes #23541: Multiline Ctrl+D does not work in CRLF files

上级 c9f06d86
......@@ -525,7 +525,7 @@ function multiCursorFind(editor: editorCommon.ICommonCodeEditor, input: IMultiCu
searchText = word.word;
currentMatch = new Selection(s.startLineNumber, word.startColumn, s.startLineNumber, word.endColumn);
} else {
searchText = editor.getModel().getValueInRange(s);
searchText = editor.getModel().getValueInRange(s).replace(/\r\n/g, '\n');
}
if (input.changeFindSearchString) {
controller.setSearchString(searchText);
......
......@@ -9,7 +9,7 @@ import { EditOperation } from 'vs/editor/common/core/editOperation';
import { Position } from 'vs/editor/common/core/position';
import { Selection } from 'vs/editor/common/core/selection';
import { Range } from 'vs/editor/common/core/range';
import { IRange } from 'vs/editor/common/editorCommon';
import { IRange, EndOfLineSequence } from 'vs/editor/common/editorCommon';
import {
CommonFindController, FindStartFocusAction, IFindStartOptions,
NextMatchFindAction, StartFindAction, SelectHighlightsAction,
......@@ -350,6 +350,40 @@ suite('FindController', () => {
});
});
test('issue #23541: Multiline Ctrl+D does not work in CRLF files', () => {
withMockCodeEditor([
'',
'qwe',
'rty',
'',
'qwe',
'',
'rty',
'qwe',
'rty'
], {}, (editor, cursor) => {
editor.getModel().setEOL(EndOfLineSequence.CRLF);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let addSelectionToNextFindMatch = new AddSelectionToNextFindMatchAction();
editor.setSelection(new Selection(2, 1, 3, 4));
addSelectionToNextFindMatch.run(null, editor);
assert.deepEqual(editor.getSelections().map(fromRange), [
[2, 1, 3, 4],
[8, 1, 9, 4]
]);
editor.trigger('test', 'removeSecondaryCursors', null);
assert.deepEqual(fromRange(editor.getSelection()), [2, 1, 3, 4]);
findController.dispose();
});
});
test('issue #18111: Regex replace with single space replaces with no space', () => {
withMockCodeEditor([
'HRESULT OnAmbientPropertyChange(DISPID dispid);'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册