Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
highlight line
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonLaster committed Jul 5, 2018
1 parent 4c255d1 commit 5814d36
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/Editor/HighlightLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function isDocumentReady(selectedSource, selectedLocation) {
export class HighlightLine extends Component<Props> {
isStepping: boolean = false;
previousEditorLine: ?number = null;
shouldHighlight: boolean = false;

shouldComponentUpdate(nextProps: Props) {
const { selectedLocation, selectedSource } = nextProps;
Expand All @@ -70,6 +71,11 @@ export class HighlightLine extends Component<Props> {
editorLine !== this.previousEditorLine ||
this.props.selectedSource !== selectedSource
) {
if (!this.shouldHighlight) {
this.shouldHighlight = true;
return false;
}

return true;
}

Expand Down Expand Up @@ -103,6 +109,7 @@ export class HighlightLine extends Component<Props> {
if (!this.shouldSetHighlightLine(selectedLocation, selectedSource)) {
return;
}

this.isStepping = false;
const editorLine = toEditorLine(sourceId, line);
this.previousEditorLine = editorLine;
Expand Down

0 comments on commit 5814d36

Please sign in to comment.