This commit is contained in:
Alex Dima 2020-12-03 20:39:33 +01:00
parent 450ae69a33
commit 7ecce71a48
No known key found for this signature in database
GPG key ID: 6E58D7B045760DA0
2 changed files with 46 additions and 2 deletions

View file

@ -412,7 +412,11 @@ export class CursorMoveCommands {
const skipWrappingPointStop = hasMultipleCursors || !cursor.viewState.hasSelection();
let newViewState = MoveOperations.moveLeft(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, noOfColumns);
if (skipWrappingPointStop && noOfColumns === 1 && newViewState.position.lineNumber !== cursor.viewState.position.lineNumber) {
if (skipWrappingPointStop
&& noOfColumns === 1
&& cursor.viewState.position.column === viewModel.getLineMinColumn(cursor.viewState.position.lineNumber)
&& newViewState.position.lineNumber !== cursor.viewState.position.lineNumber
) {
// moved over to the previous view line
const newViewModelPosition = viewModel.coordinatesConverter.convertViewPositionToModelPosition(newViewState.position);
if (newViewModelPosition.lineNumber === cursor.modelState.position.lineNumber) {
@ -445,7 +449,11 @@ export class CursorMoveCommands {
const skipWrappingPointStop = hasMultipleCursors || !cursor.viewState.hasSelection();
let newViewState = MoveOperations.moveRight(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, noOfColumns);
if (skipWrappingPointStop && noOfColumns === 1 && newViewState.position.lineNumber !== cursor.viewState.position.lineNumber) {
if (skipWrappingPointStop
&& noOfColumns === 1
&& cursor.viewState.position.column === viewModel.getLineMaxColumn(cursor.viewState.position.lineNumber)
&& newViewState.position.lineNumber !== cursor.viewState.position.lineNumber
) {
// moved over to the next view line
const newViewModelPosition = viewModel.coordinatesConverter.convertViewPositionToModelPosition(newViewState.position);
if (newViewModelPosition.lineNumber === cursor.modelState.position.lineNumber) {

View file

@ -2208,6 +2208,42 @@ suite('Editor Controller - Regression tests', () => {
});
});
test('issue #110376: multiple selections with wordwrap behave differently', () => {
// a single model line => 4 view lines
withTestCodeEditor([
[
'just a sentence. just a ',
'sentence. just a sentence.',
].join('')
], { wordWrap: 'wordWrapColumn', wordWrapColumn: 25 }, (editor, viewModel) => {
viewModel.setSelections('test', [
new Selection(1, 1, 1, 16),
new Selection(1, 18, 1, 33),
new Selection(1, 35, 1, 50),
]);
moveLeft(editor, viewModel);
assertCursor(viewModel, [
new Selection(1, 1, 1, 1),
new Selection(1, 18, 1, 18),
new Selection(1, 35, 1, 35),
]);
viewModel.setSelections('test', [
new Selection(1, 1, 1, 16),
new Selection(1, 18, 1, 33),
new Selection(1, 35, 1, 50),
]);
moveRight(editor, viewModel);
assertCursor(viewModel, [
new Selection(1, 16, 1, 16),
new Selection(1, 33, 1, 33),
new Selection(1, 50, 1, 50),
]);
});
});
test('issue #98320: Multi-Cursor, Wrap lines and cursorSelectRight ==> cursors out of sync', () => {
// a single model line => 4 view lines
withTestCodeEditor([