revealInCenterIfOutsideViewport

#17073
This commit is contained in:
isidor
2016-12-19 16:28:46 +01:00
parent a5b68ad307
commit 7a8159c844
5 changed files with 28 additions and 6 deletions

View File

@@ -596,6 +596,7 @@ export class TextEditorOptions extends EditorOptions {
protected endLineNumber: number;
protected endColumn: number;
private revealInCenterIfOutsideViewport: boolean;
private editorViewState: IEditorViewState;
private editorOptions: ICodeEditorOptions;
@@ -631,6 +632,10 @@ export class TextEditorOptions extends EditorOptions {
options.inactive = true;
}
if (input.options.revealInCenterIfOutsideViewport) {
options.revealInCenterIfOutsideViewport = true;
}
if (typeof input.options.index === 'number') {
options.index = input.options.index;
}
@@ -737,7 +742,11 @@ export class TextEditorOptions extends EditorOptions {
endColumn: this.endColumn
};
editor.setSelection(range);
editor.revealRangeInCenter(range);
if (this.revealInCenterIfOutsideViewport) {
editor.revealRangeInCenterIfOutsideViewport(range);
} else {
editor.revealRangeInCenter(range);
}
}
// Reveal
@@ -747,7 +756,11 @@ export class TextEditorOptions extends EditorOptions {
column: this.startColumn
};
editor.setPosition(pos);
editor.revealPositionInCenter(pos);
if (this.revealInCenterIfOutsideViewport) {
editor.revealPositionInCenterIfOutsideViewport(pos);
} else {
editor.revealPositionInCenter(pos);
}
}
gotApplied = true;