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: help triggering text autocmds #1090

Merged
merged 1 commit into from
Jul 16, 2024
Merged

Conversation

MithicSpirit
Copy link
Contributor

@MithicSpirit MithicSpirit commented Jul 15, 2024

The default filetype detection algorithm only checks the last lines of
.txt files for "ft=help" before setting the filetype to "text". Since
there was an empty line at the end, the help page was getting marked as
having filetype text first, and then help, which meant both autocmds
were triggered. This fixes that by removing the extraneous newline; note
that there is still a newline at the end of file, as is customary, and
this just removes the second, unnecessary newline.

Furthermore, this simplifies the logic for "gen_help.lua" and increases
its robustness by using the "io.lines" function rather than reading the
entire file as a string and using regular expressions to split it into
lines.

@MithicSpirit
Copy link
Contributor Author

MithicSpirit commented Jul 15, 2024

oops just realized that this is autogenerated with a script. will try to fix the script instead fixed

@MithicSpirit MithicSpirit marked this pull request as draft July 15, 2024 23:09
The default filetype detection algorithm only checks the last lines of
.txt files for "ft=help" before setting the filetype to "text". Since
there was an empty line at the end, the help page was getting marked as
having filetype text first, and then help, which meant both autocmds
were triggered. This fixes that by removing the extraneous newline; note
that there is still a newline at the end of file, as is customary, and
this just removes the second, unnecessary newline.

Furthermore, this simplifies the logic for "gen_help.lua" and increases
its robustness by using the "io.lines" function rather than reading the
entire file as a string and using regular expressions to split it into
lines.
@MithicSpirit MithicSpirit marked this pull request as ready for review July 15, 2024 23:26
@lewis6991 lewis6991 merged commit 2a7b39f into lewis6991:main Jul 16, 2024
6 checks passed
@lewis6991
Copy link
Owner

Thanks!

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.

None yet

2 participants