提交 75e228d8 编写于 作者: R rebornix

Fix #50471. Join Lines should not pass in NaN as position.

上级 e8befb9f
......@@ -595,9 +595,9 @@ export class JoinLinesAction extends EditorAction {
let selection = reducedSelections[i];
let startLineNumber = selection.startLineNumber;
let startColumn = 1;
let columnDeltaOffset = 0;
let endLineNumber: number,
endColumn: number,
columnDeltaOffset: number;
endColumn: number;
let selectionEndPositionOffset = model.getLineContent(selection.endLineNumber).length - selection.endColumn;
......
......@@ -265,6 +265,23 @@ suite('Editor Contrib - Line Operations', () => {
});
});
test('#50471 Join lines at the end of document', function () {
withTestCodeEditor(
[
'hello',
'world'
], {}, (editor, cursor) => {
let model = editor.getModel();
let joinLinesAction = new JoinLinesAction();
editor.setSelection(new Selection(2, 1, 2, 1));
joinLinesAction.run(null, editor);
assert.equal(model.getLineContent(1), 'hello', '001');
assert.equal(model.getLineContent(2), 'world', '002');
assert.deepEqual(editor.getSelection().toString(), new Selection(2, 6, 2, 6).toString(), '003');
});
});
test('should work in multi cursor mode', function () {
withTestCodeEditor(
[
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册