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

Markdown: textual numbers are mistaken for <pre> characters at margins #117

Closed
rdipardo opened this issue Nov 12, 2022 · 2 comments
Closed
Labels
committed Issue fixed in repository but not in release markdown Caused by the markdown lexer

Comments

@rdipardo
Copy link
Contributor

At the start of every line, LexMarkdown::Lex defaults to SCE_MARKDOWN_PRECHAR in the absence of any reserved markup token:

else {
precharCount = 0;
sc.SetState(SCE_MARKDOWN_PRECHAR);
}

This is supposed to set off indented code blocks by filling the leading white space. But a textual number with no leading white space is also filled as if the digits were <pre> characters:

Text:

The number:

338269006135764734700913562171

is prime

Styles:

{0}The number:{1}

{12}338269006135764734700913562171{1}

{0}is prime{1}

scite-531-mkd

Every digit is captured because a subsequent code path increments the style region as if the number were an ordered list item:

// Ordered list
else if (IsADigit(sc.ch)) {
int digitCount = 0;
while (IsADigit(sc.GetRelative(++digitCount)))
;

This patch adds a corrective fallback to SCE_MARKDOWN_DEFAULT as soon as a string of digits fails to match a list item:

0001-LexMarkdown-Fix-numbers-as-pre-char.diff.txt

@rdipardo
Copy link
Contributor Author

These are the tests: Issue117-Tests.diff.txt

@nyamatongwe nyamatongwe added the markdown Caused by the markdown lexer label Nov 13, 2022
@nyamatongwe nyamatongwe added the committed Issue fixed in repository but not in release label Nov 13, 2022
@nyamatongwe
Copy link
Member

Included in 5.2.1 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
committed Issue fixed in repository but not in release markdown Caused by the markdown lexer
Projects
None yet
Development

No branches or pull requests

2 participants