提交 1349f0a0 编写于 作者: B Benjamin Pasero

grid - fix npe when closing editor

上级 31694f7a
......@@ -76,7 +76,6 @@ export class DiffNavigator {
if (this._options.alwaysRevealFirst) {
this._disposables.push(this._editor.getModifiedEditor().onDidChangeModel((e) => {
this.revealFirst = true;
console.log('diff model changed. revealFirst', this.revealFirst);
}));
}
......@@ -95,16 +94,12 @@ export class DiffNavigator {
this._init();
this._compute(this._editor.getLineChanges());
console.log('_onDiffUpdated, revealFirst', this.revealFirst);
if (this.revealFirst) {
// Only reveal first on first non-null changes
if (this._editor.getLineChanges() !== null) {
this.revealFirst = false;
this.nextIdx = -1;
this.next(ScrollType.Immediate);
console.log('having line changes, going to next');
} else {
console.log('not having any line changes!');
}
}
}
......@@ -174,10 +169,8 @@ export class DiffNavigator {
private _move(fwd: boolean, scrollType: ScrollType): void {
assert.ok(!this.disposed, 'Illegal State - diff navigator has been disposed');
console.log('_move');
if (!this.canNavigate()) {
console.log('!this.canNavigate()');
return;
}
......@@ -200,7 +193,6 @@ export class DiffNavigator {
this.ignoreSelectionChange = true;
try {
let pos = info.range.getStartPosition();
console.log('setting new position: ', pos);
this._editor.setPosition(pos);
this._editor.revealPositionInCenter(pos, scrollType);
} finally {
......
......@@ -267,7 +267,11 @@ function getCommandsContext(resourceOrContext: URI | IEditorCommandsContext, con
return context;
}
if (typeof resourceOrContext.groupId === 'number') {
return resourceOrContext;
}
return void 0;
}
function registerOpenEditorAtIndexCommands(): void {
......
......@@ -122,17 +122,12 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor {
optionsGotApplied = (<TextEditorOptions>options).apply(diffEditor, ScrollType.Immediate);
}
console.log('Diff Editor: setInput()');
// Otherwise restore View State
let hasPreviousViewState = false;
if (!optionsGotApplied) {
hasPreviousViewState = this.restoreTextDiffEditorViewState(input);
}
console.log('optionsGotApplied', optionsGotApplied);
console.log('hasPreviousViewState', hasPreviousViewState);
this.diffNavigator = new DiffNavigator(diffEditor, {
alwaysRevealFirst: !optionsGotApplied && !hasPreviousViewState // only reveal first change if we had no options or viewstate
});
......@@ -174,7 +169,6 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor {
if (resource) {
const viewState = this.loadTextEditorViewState(resource);
if (viewState) {
console.log('restoring viewState', viewState);
this.getControl().restoreViewState(viewState);
return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册