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

Expect autoformat delimiters to have a space character preceding them. #8619

Merged
merged 1 commit into from
Dec 11, 2020

Conversation

maxbarnas
Copy link
Contributor

@maxbarnas maxbarnas commented Dec 9, 2020

Suggested merge commit message (convention)

Fix (autoformat): Formatting will not be applied to snake_case_scenario anymore. Closes #2388.

@maxbarnas maxbarnas requested a review from Reinmar December 9, 2020 14:33
@maxbarnas maxbarnas force-pushed the i/2388 branch 3 times, most recently from e11301f to 5c59f79 Compare December 10, 2020 11:14
@@ -80,17 +80,17 @@ export default class Autoformat extends Plugin {
if ( commands.get( 'bold' ) ) {
const boldCallback = getCallbackFunctionForInlineAutoformat( this.editor, 'bold' );

inlineAutoformatEditing( this.editor, this, /(\*\*)([^*]+)(\*\*)$/g, boldCallback );
inlineAutoformatEditing( this.editor, this, /(__)([^_]+)(__)$/g, boldCallback );
inlineAutoformatEditing( this.editor, this, /(?:^|\s)(\*\*)([^*]+)(\*\*)$/g, boldCallback );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could add a comment explaining why I added this here. Not sure if that's necessary.

@@ -577,24 +613,24 @@ describe( 'Autoformat', () => {

describe( 'should format', () => {
it( '* after', () => {
setData( model, '<paragraph><$text code="true">fo*o</$text>b*ar[]</paragraph>' );
setData( model, '<paragraph><$text code="true">fo*o</$text>b *ar[]</paragraph>' );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed the test to let it format according to PR changes.

@maxbarnas maxbarnas marked this pull request as ready for review December 10, 2020 12:15
@maxbarnas maxbarnas changed the title Grab entire line for autoformatting. Match separator to narrow down the autoformatting. Expect autoformat delimiters to have a space character preceding them. Dec 10, 2020
@Reinmar
Copy link
Member

Reinmar commented Dec 10, 2020

All looks fine, but it'd be good to have a clarity on cases that you ignored and that will become possible followups.

Some that I can think of:

  • The reversed case – typing * in foo *^bar**.
  • The non-white-space delimiters:
    • typing * in foo **bar*^..
    • typing * in foo (**bar*^.
    • typing * in foo (*^bar**).

What else did you skip? It'd be good to have tickets for these scenarios.

@maxbarnas
Copy link
Contributor Author

Follow-up tickets for future improvements: #8629 and #8630.

@Reinmar Reinmar merged commit 82d486d into master Dec 11, 2020
@Reinmar Reinmar deleted the i/2388 branch December 11, 2020 07:52
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.

Markdown autoformat italics bug
2 participants