Skip to content

Fix codebox highlighting after switching files#1647

Merged
damianhxy merged 2 commits into
masterfrom
fix-codebox-highlight
Nov 23, 2022
Merged

Fix codebox highlighting after switching files#1647
damianhxy merged 2 commits into
masterfrom
fix-codebox-highlight

Conversation

@damianhxy

@damianhxy damianhxy commented Nov 21, 2022

Copy link
Copy Markdown
Member

Description

Moved #highlightLongLines event listener into attachEvents function.

Motivation and Context

Currently, the event listener for the "highlight lines longer than 80 characters" checkbox is only attached once on page load.

However, when switching files, the elements of the codebox is replaced, meaning that the listener no longer works.

This PR attaches the event listener inside the attachEvents function instead, which is called on

  • page load
  • switching files (cached)
  • switching files (uncached)

How Has This Been Tested?

  • Make a submission with a file containing > 80 characters (for example, submit to hello and the first line of the autograder output suffices)
  • Load autograder output directly, check box functionality (page load)
  • Load another file directly, check box functionality (switching files uncached)
  • Load autograder output directly, switch away and switch back, check box functionality (switching files cached)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have run rubocop for style check. If you haven't, run overcommit --install && overcommit --sign to use pre-commit hook for linting

@damianhxy damianhxy requested a review from 20wildmanj November 21, 2022 06:34

@20wildmanj 20wildmanj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good to me, and verified that highlighting stays active after switching. I was unable to reproduce the original case of highlighting failing however, if possible could I get a more specific flow to break the highlighting?

@damianhxy

Copy link
Copy Markdown
Member Author
Screen.Recording.2022-11-23.at.11.56.49.mov

@20wildmanj

Copy link
Copy Markdown
Contributor

Ah I see, was able to reproduce. All good to merge in

@damianhxy damianhxy merged commit d1b2b5b into master Nov 23, 2022
@damianhxy damianhxy deleted the fix-codebox-highlight branch November 23, 2022 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants