From 9118a098a9452d74627839b549d1053ee8b9934e Mon Sep 17 00:00:00 2001 From: Hubert Boma Manilla Date: Fri, 20 Oct 2017 14:43:09 +0100 Subject: [PATCH 1/2] fix bug where the line being 0 returns a falsy and does not cause the line to flash --- src/components/Editor/index.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/Editor/index.js b/src/components/Editor/index.js index bc7272e0f4..e73b2719d8 100644 --- a/src/components/Editor/index.js +++ b/src/components/Editor/index.js @@ -245,7 +245,7 @@ class Editor extends PureComponent { // Only update and jump around in real source texts. This will // keep the jump state around until the real source text is // loaded. - if (selectedSource && selectedSource.has("text")) { + if (selectedSource && selectedSource.get("loadedState") === "loaded") { this.highlightLine(); } } @@ -409,7 +409,7 @@ class Editor extends PureComponent { // cancel any existing animation, but it avoids it from // happening ever again (in case CodeMirror re-applies the // class, etc). - if (this.lastJumpLine) { + if (this.lastJumpLine !== null) { clearLineClass(this.state.editor.codeMirror, "highlight-line"); } @@ -423,8 +423,8 @@ class Editor extends PureComponent { // Also, if it the first time the debugger is being loaded, we don't want // to flash the previously saved selected line. if ( - line && - this.lastJumpLine && + line !== null && + this.lastJumpLine !== null && (!selectedFrame || selectedFrame.location.line !== line) ) { this.state.editor.codeMirror.addLineClass(line, "line", "highlight-line"); @@ -437,7 +437,6 @@ class Editor extends PureComponent { scrollToPosition() { const { sourceId, line, column } = this.props.selectedLocation; const editorLine = toEditorLine(sourceId, line); - scrollToColumn(this.state.editor.codeMirror, editorLine, column); return editorLine; } From 1493dca12517310d7eb701ebddaca4a9cb56f555 Mon Sep 17 00:00:00 2001 From: Hubert Boma Manilla Date: Fri, 20 Oct 2017 15:32:37 +0100 Subject: [PATCH 2/2] use isLoaded util --- src/components/Editor/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Editor/index.js b/src/components/Editor/index.js index e73b2719d8..32c4f075db 100644 --- a/src/components/Editor/index.js +++ b/src/components/Editor/index.js @@ -245,7 +245,7 @@ class Editor extends PureComponent { // Only update and jump around in real source texts. This will // keep the jump state around until the real source text is // loaded. - if (selectedSource && selectedSource.get("loadedState") === "loaded") { + if (selectedSource && isLoaded(selectedSource.toJS())) { this.highlightLine(); } }