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: codeblock without "<" consumes extra char #25

Merged
merged 3 commits into from
Sep 30, 2022

Conversation

justinmk
Copy link
Member

  • fix: codeblock without "<" consumes extra char
  • fix: headings after implicitly-terminated codeblock

Problem:
If a codeblock does not have a terminating "<" char, it consumes the
first char of the next token.

Solution:
Define (codeblock) only in terms of its lines; it doesn't need to look
for its "end". Instead, add $._line_end_codeblock to the list of things
that can terminate a (block).
Problem:
`block` has no way to terminate just after an implicitly-terminated
`codeblock`, so the next line is always parsed as a plain `line` instead
of a heading (h1/h2/h3). Because headings and `block` both are top-level
forms, this prevents headings from being recognized in this case.

Solution:
Change headings (h1/h2/h3) to be contained by `line`. They are no longer
top-level.
(h1
(word)
(tag
(word))))
Copy link
Member Author

Choose a reason for hiding this comment

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

h1/h2/h3 are no longer top-level elements, they are now contained by line. This is necessary because implicitly-terminated codeblock (without <) consumes blank lines (because codeblocks can have blank and empty lines), so there is no way for block to know when to terminate and allow other top-level elements to start.

@justinmk justinmk merged commit c418f88 into neovim:master Sep 30, 2022
@justinmk justinmk deleted the fixcodeblock branch September 30, 2022 11:41
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.

1 participant