Fix for standard in hovering in code cell (#6107)

This commit is contained in:
Chris LaFreniere
2019-06-19 15:02:03 -07:00
committed by GitHub
parent 7a689b93db
commit 453caa92d4
4 changed files with 15 additions and 2 deletions

View File

@@ -232,7 +232,7 @@ export class CodeComponent extends AngularDisposable implements OnInit, OnChange
}));
this._register(this.model.layoutChanged(() => this._layoutEmitter.fire(), this));
this._register(this.cellModel.onExecutionStateChange(event => {
if (event === CellExecutionState.Running) {
if (event === CellExecutionState.Running && !this.cellModel.stdInVisible) {
this.setFocusAndScroll();
}
}));

View File

@@ -81,6 +81,7 @@ export class CodeCellComponent extends CellView implements OnInit, OnChanges {
if (msg) {
this.stdIn = msg;
this.inputDeferred = new Deferred();
this.cellModel.stdInVisible = true;
this._changeRef.detectChanges();
return this.awaitStdIn();
}
@@ -97,11 +98,12 @@ export class CodeCellComponent extends CellView implements OnInit, OnChanges {
// Clean up so no matter what, the stdIn request goes away
this.stdIn = undefined;
this.inputDeferred = undefined;
this.cellModel.stdInVisible = false;
this._changeRef.detectChanges();
}
}
get isStdInVisible(): boolean {
return !!(this.stdIn && this.inputDeferred);
return this.cellModel.stdInVisible;
}
}

View File

@@ -42,6 +42,7 @@ export class CellModel implements ICellModel {
private _stdInHandler: nb.MessageHandler<nb.IStdinMessage>;
private _onCellLoaded = new Emitter<string>();
private _loaded: boolean;
private _stdInVisible: boolean;
constructor(cellData: nb.ICellContents,
private _options: ICellModelOptions,
@@ -56,6 +57,7 @@ export class CellModel implements ICellModel {
this._source = '';
}
this._isEditMode = this._cellType !== CellTypes.Markdown;
this._stdInVisible = false;
if (_options && _options.isTrusted) {
this._isTrusted = true;
} else {
@@ -200,6 +202,14 @@ export class CellModel implements ICellModel {
}
}
public get stdInVisible(): boolean {
return this._stdInVisible;
}
public set stdInVisible(val: boolean) {
this._stdInVisible = val;
}
private notifyExecutionComplete(): void {
if (this._notebookService) {
this._notebookService.serializeNotebookStateChange(this.notebookModel.notebookUri, NotebookChangeType.CellExecuted);

View File

@@ -467,6 +467,7 @@ export interface ICellModel {
equals(cellModel: ICellModel): boolean;
toJSON(): nb.ICellContents;
loaded: boolean;
stdInVisible: boolean;
readonly onLoaded: Event<string>;
}