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

Trim trailing whitespace from prefix in indent #353

Merged
merged 1 commit into from
May 13, 2021

Conversation

mgeisler
Copy link
Owner

Before, empty lines would get no prefix added. Now, empty lines have a trimmed prefix added.

This little trick makes indent much more useful: you can now indent with "# " without fearing creating trailing whitespace in the output due to the trailing whitespace in your prefix.

When you indent with a prefix of pure whitespace, such as " " or similar, you will see no difference. If you indent with a non-whitespace prefix, you will now see it added to every line of your input.

Before, empty lines would get no prefix added. Now, empty lines have a
trimmed prefix added.

This little trick makes `indent` much more useful: you can now indent
with `"# "` without fearing creating trailing whitespace in the output
due to the trailing whitespace in your prefix.

When you indent with a prefix of pure whitespace, such as `" "` or
similar, you will see no difference. If you indent with a
non-whitespace prefix, you will now see it added to every line of your
input.
@mgeisler mgeisler force-pushed the indent-trim-trailing-whitespace branch from ea739af to fb98836 Compare May 13, 2021 11:51
@mgeisler mgeisler enabled auto-merge May 13, 2021 11:53
@mgeisler mgeisler merged commit 7a9a65c into master May 13, 2021
@mgeisler mgeisler deleted the indent-trim-trailing-whitespace branch May 13, 2021 11:54
This was referenced May 30, 2021
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