Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/components/Editor/index.js b/src/components/Editor/index.js
- index 90468a5..88714ca 100644
- --- a/src/components/Editor/index.js
- +++ b/src/components/Editor/index.js
- @@ -100,15 +100,10 @@ type State = {
- class Editor extends PureComponent<Props, State> {
- cbPanel: any;
- editor: SourceEditor;
- - pendingJumpLocation: any;
- - lastJumpLine: any;
- constructor() {
- super();
- - this.pendingJumpLocation = null;
- - this.lastJumpLine = null;
- -
- this.state = {
- highlightedLineRange: null,
- editor: null
- @@ -200,10 +195,6 @@ class Editor extends PureComponent<Props, State> {
- shortcuts.on(searchAgainPrevKey, this.onSearchAgain);
- shortcuts.on(searchAgainKey, this.onSearchAgain);
- - if (selectedLocation && !!selectedLocation.line) {
- - this.pendingJumpLocation = selectedLocation;
- - }
- -
- const sourceId = selectedSource ? selectedSource.get("id") : undefined;
- updateDocument(editor, sourceId);
- }
- @@ -234,19 +225,6 @@ class Editor extends PureComponent<Props, State> {
- // responsible for updating the editor annotations.
- const { selectedLocation, selectedSource } = this.props;
- - // If the location is different and a new line is requested,
- - // update the pending jump line. Note that if jumping to a line in
- - // a source where the text hasn't been loaded yet, we will set the
- - // line here but not jump until rendering the actual source.
- -
- - if (prevProps.selectedLocation !== selectedLocation) {
- - if (selectedLocation && selectedLocation.line != undefined) {
- - this.pendingJumpLocation = selectedLocation;
- - } else {
- - this.pendingJumpLocation = null;
- - }
- - }
- -
- // NOTE:
- // 1. Only update and jump around in real source texts. This will
- // keep the jump state around until the real source text is loaded.
- @@ -423,42 +401,22 @@ class Editor extends PureComponent<Props, State> {
- return this.props.closeConditionalPanel();
- };
- - // If the location has changed and a specific line is requested,
- - // move to that line and flash it.
- - highlightLine() {
- - const { selectedLocation, selectedFrame } = this.props;
- - if (!selectedLocation) {
- - return;
- - }
- -
- - // Make sure to clean up after ourselves. Not only does this
- - // cancel any existing animation, but it avoids it from
- - // happening ever again (in case CodeMirror re-applies the
- - // class, etc).
- - if (this.lastJumpLine !== null) {
- - clearLineClass(this.state.editor.codeMirror, "highlight-line");
- - }
- -
- - let line = null;
- - if (selectedLocation.line >= 0) {
- - line = this.scrollToPosition();
- - }
- + scrollToLocation() {
- + this.scrollToPosition();
- + }
- - // We only want to do the flashing animation if it's not a debug
- - // line, which has it's own styling.
- - // Also, if it the first time the debugger is being loaded, we don't want
- - // to flash the previously saved selected line.
- - if (
- - line !== null &&
- - this.lastJumpLine !== null &&
- - this.lastJumpLine !== line &&
- - (!selectedFrame || selectedFrame.location.line !== line)
- - ) {
- - this.state.editor.codeMirror.addLineClass(line, "line", "highlight-line");
- - }
- + clearHighlightLine() {
- + clearLineClass(this.state.editor.codeMirror, "highlight-line");
- + }
- - this.lastJumpLine = line;
- - this.pendingJumpLocation = null;
- + highlightLine() {
- + const { sourceId, line } = this.props.selectedLocation;
- + const editorLine = toEditorLine(sourceId, line);
- + this.state.editor.codeMirror.addLineClass(
- + editorLine,
- + "line",
- + "highlight-line"
- + );
- }
- scrollToPosition() {
Add Comment
Please, Sign In to add comment