mirror of
https://github.com/Microsoft/vscode
synced 2024-10-05 19:02:54 +00:00
Fixes #80736
This commit is contained in:
parent
85e410a0fb
commit
8c9b9589cf
|
@ -179,7 +179,7 @@ export class ShiftCommand implements ICommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, indentationEndIndex + 1), desiredIndent);
|
this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, indentationEndIndex + 1), desiredIndent);
|
||||||
if (lineNumber === startLine) {
|
if (lineNumber === startLine && !this._selection.isEmpty()) {
|
||||||
// Force the startColumn to stay put because we're inserting after it
|
// Force the startColumn to stay put because we're inserting after it
|
||||||
this._selectionStartColumnStaysPut = (this._selection.startColumn <= indentationEndIndex + 1);
|
this._selectionStartColumnStaysPut = (this._selection.startColumn <= indentationEndIndex + 1);
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ export class ShiftCommand implements ICommand {
|
||||||
this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, indentationEndIndex + 1), '');
|
this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, indentationEndIndex + 1), '');
|
||||||
} else {
|
} else {
|
||||||
this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, 1), oneIndent);
|
this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, 1), oneIndent);
|
||||||
if (lineNumber === startLine) {
|
if (lineNumber === startLine && !this._selection.isEmpty()) {
|
||||||
// Force the startColumn to stay put because we're inserting after it
|
// Force the startColumn to stay put because we're inserting after it
|
||||||
this._selectionStartColumnStaysPut = (this._selection.startColumn === 1);
|
this._selectionStartColumnStaysPut = (this._selection.startColumn === 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -928,6 +928,28 @@ suite('Editor Contrib - Line Operations', () => {
|
||||||
model.dispose();
|
model.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('issue #80736: Indenting while the cursor is at the start of a line of text causes the added spaces or tab to be selected', () => {
|
||||||
|
const model = createTextModel(
|
||||||
|
[
|
||||||
|
'Some text'
|
||||||
|
].join('\n'),
|
||||||
|
{
|
||||||
|
insertSpaces: false,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
withTestCodeEditor(null, { model: model }, (editor) => {
|
||||||
|
const indentLinesAction = new IndentLinesAction();
|
||||||
|
editor.setPosition(new Position(1, 1));
|
||||||
|
|
||||||
|
indentLinesAction.run(null!, editor);
|
||||||
|
assert.equal(model.getLineContent(1), '\tSome text');
|
||||||
|
assert.deepEqual(editor.getSelection(), new Selection(1, 2, 1, 2));
|
||||||
|
});
|
||||||
|
|
||||||
|
model.dispose();
|
||||||
|
});
|
||||||
|
|
||||||
test('issue #62112: Delete line does not work properly when multiple cursors are on line', () => {
|
test('issue #62112: Delete line does not work properly when multiple cursors are on line', () => {
|
||||||
const TEXT = [
|
const TEXT = [
|
||||||
'a',
|
'a',
|
||||||
|
|
|
@ -92,7 +92,7 @@ suite('Editor Commands - ShiftCommand', () => {
|
||||||
'',
|
'',
|
||||||
'123'
|
'123'
|
||||||
],
|
],
|
||||||
new Selection(1, 1, 1, 2)
|
new Selection(1, 2, 1, 2)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue