提交 185e7de4 编写于 作者: A Alexandru Dima 提交者: GitHub

Merge pull request #34933 from yume-chan/master

Scroll to selection after cursorUndo command
......@@ -8,7 +8,7 @@ import { Selection } from 'vs/editor/common/core/selection';
import { editorCommand, ServicesAccessor, EditorCommand } from 'vs/editor/common/editorCommonExtensions';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { Disposable } from 'vs/base/common/lifecycle';
import { ICommonCodeEditor, IEditorContribution } from 'vs/editor/common/editorCommon';
import { ICommonCodeEditor, IEditorContribution, ScrollType } from 'vs/editor/common/editorCommon';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { editorContribution } from 'vs/editor/browser/editorBrowserExtensions';
......@@ -72,7 +72,7 @@ export class CursorUndoController extends Disposable implements IEditorContribut
this._undoStack.push(this._prevState);
if (this._undoStack.length > 50) {
// keep the cursor undo stack bounded
this._undoStack = this._undoStack.splice(0, this._undoStack.length - 50);
this._undoStack.shift();
}
}
......@@ -102,6 +102,7 @@ export class CursorUndoController extends Disposable implements IEditorContribut
if (!prevState.equals(currState)) {
this._isCursorUndo = true;
this._editor.setSelections(prevState.selections);
this._editor.revealRangeInCenterIfOutsideViewport(prevState.selections[0], ScrollType.Smooth);
this._isCursorUndo = false;
return;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册