Skip to content

Conversation

clason
Copy link
Member

@clason clason commented Mar 19, 2024

Problem: Including leading whitespace in modeline leads (somehow) to
leading whitespace being included in other nodes, especially taglink,
and thus concealed. This breaks right-aligned taglinks in Neovim
documentation.

Solution: Do not include whitespace in modeline.

Problem: Including leading whitespace in modeline leads (somehow) to
leading whitespace being included in other nodes, especially `taglink`,
and thus concealed. This breaks right-aligned taglinks in Neovim
documentation.

Solution: Do not include whitespace in modeline.
@clason clason merged commit 6ec0d20 into master Mar 19, 2024
@clason clason deleted the fix/modeline branch March 19, 2024 18:11

// Modeline: must start with "vim:" (optionally preceded by whitespace)
modeline: ($) => token(prec(2, /[\t ]*vim:[^\n]+\n/)),
modeline: ($) => token(prec(2, /vim:[^\n]+\n/)),
Copy link
Member

@justinmk justinmk Mar 20, 2024

Choose a reason for hiding this comment

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

Yeah, explicitly matching whitespace in the token always causes problems. And it's not needed here anyway, because modeline is defined as a top-level ("block") token:

help_file: ($) =>
seq(
repeat($._blank), // Eat blank lines at top of file.
repeat($.block),
repeat($.modeline),

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup. This slipped by me in review.

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