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

Command Line refactoring #2290

Merged

Conversation

RunDevelopment
Copy link
Member

This fixes #2289.

The actual fix is quite simple:

-if (env.element.querySelector('.command-line-prompt')) { // Abort if prompt already exists.
-	commandLine.complete = true;
-	return;
-}
+// The element might be highlighted multiple times, so we just remove the previous prompt
+var existingPrompt = env.element.querySelector('.command-line-prompt');
+if (existingPrompt) {
+	existingPrompt.remove();
+}

But I also took the time to refactor Command Line a little.

@mAAdhaTTah
Copy link
Member

It would be easier to review this if the stylistic changes were in a separate PR. Between the refactor, the actual change, & the indentation, I'm not really sure what I'm looking at here.

@RunDevelopment RunDevelopment changed the title Command Line now correctly rehighlights elements Command Line refactoring Apr 7, 2020
Copy link
Member

@mAAdhaTTah mAAdhaTTah left a comment

Choose a reason for hiding this comment

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

This was easier to review once I turned whitespace changes off. This looks good.

@RunDevelopment RunDevelopment merged commit 8c9c289 into PrismJS:master Jun 27, 2020
@RunDevelopment RunDevelopment deleted the command-line-rehighlight-fix branch June 27, 2020 18:46
quentinvernot pushed a commit to TankerHQ/prismjs that referenced this pull request Sep 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

command-line plugin does not display the prompt (spans outside of their container)
2 participants