mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 10:15:41 +00:00
Fixes #110376
This commit is contained in:
parent
450ae69a33
commit
7ecce71a48
2 changed files with 46 additions and 2 deletions
|
@ -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) {
|
||||
|
|
|
@ -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([
|
||||
|
|
Loading…
Reference in a new issue