Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix codebox highlighting after switching files #1647

Merged
merged 2 commits into from
Nov 23, 2022
Merged

Conversation

damianhxy
Copy link
Member

@damianhxy damianhxy commented Nov 21, 2022

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

Copy link
Contributor

@20wildmanj 20wildmanj left a comment

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
Member Author

Screen.Recording.2022-11-23.at.11.56.49.mov

@20wildmanj
Copy link
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