Skip to content

Commit

Permalink
Merge pull request #7672 from blink1073/fix-input-area-display
Browse files Browse the repository at this point in the history
Fix handling of code editor refresh
  • Loading branch information
Steven Silvester committed Dec 23, 2019
2 parents 72d9e17 + 6120442 commit 3c6521e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/codeeditor/src/widget.ts
Expand Up @@ -121,6 +121,9 @@ export class CodeEditorWrapper extends Widget {
node.addEventListener('p-dragleave', this);
node.addEventListener('p-dragover', this);
node.addEventListener('p-drop', this);
// We have to refresh at least once after attaching,
// while visible.
this._hasRefreshedSinceAttach = false;
if (this.isVisible) {
this.update();
}
Expand All @@ -141,7 +144,7 @@ export class CodeEditorWrapper extends Widget {
* A message handler invoked on an `'after-show'` message.
*/
protected onAfterShow(msg: Message): void {
if (this._updateOnShow) {
if (this._updateOnShow || !this._hasRefreshedSinceAttach) {
this.update();
}
}
Expand All @@ -161,7 +164,10 @@ export class CodeEditorWrapper extends Widget {
* A message handler invoked on an `'update-request'` message.
*/
protected onUpdateRequest(msg: Message): void {
this.editor.refresh();
if (this.isVisible) {
this._hasRefreshedSinceAttach = true;
this.editor.refresh();
}
}

/**
Expand Down Expand Up @@ -278,6 +284,7 @@ export class CodeEditorWrapper extends Widget {
}

private _updateOnShow: boolean;
private _hasRefreshedSinceAttach = false;
}

/**
Expand Down

0 comments on commit 3c6521e

Please sign in to comment.