提交 8c9b9589 编写于 作者: A Alex Dima

Fixes #80736

上级 85e410a0
......@@ -179,7 +179,7 @@ export class ShiftCommand implements ICommand {
}
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
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), '');
} else {
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
this._selectionStartColumnStaysPut = (this._selection.startColumn === 1);
}
......
......@@ -928,6 +928,28 @@ suite('Editor Contrib - Line Operations', () => {
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', () => {
const TEXT = [
'a',
......
......@@ -92,7 +92,7 @@ suite('Editor Commands - ShiftCommand', () => {
'',
'123'
],
new Selection(1, 1, 1, 2)
new Selection(1, 2, 1, 2)
);
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册