提交 36ce4f6b 编写于 作者: B Benjamin Pasero

diff - temporary console log to debug diff reveal issues

上级 0173e961
......@@ -76,6 +76,7 @@ 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);
}));
}
......@@ -94,12 +95,16 @@ 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!');
}
}
}
......@@ -169,8 +174,10 @@ 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;
}
......@@ -193,6 +200,7 @@ 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 {
......
......@@ -157,12 +157,17 @@ 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
});
......@@ -204,6 +209,7 @@ 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.
先完成此消息的编辑!
想要评论请 注册