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

Added an option to strip trailing whitespace on paste #1904

Merged
merged 2 commits into from
Jan 19, 2021

Conversation

steveniemitz
Copy link
Contributor

Fixes #1888

@steveniemitz
Copy link
Contributor Author

ping?

@ximion ximion force-pushed the master branch 6 times, most recently from b53c46c to 2f9d050 Compare January 18, 2021 21:50
@ximion
Copy link
Collaborator

ximion commented Jan 18, 2021

I see the sense in this patch - did you test the current PR?
D's string.stripRight() will indeed remove all whitespaces from the end of a line, but it will not remove any newline or tab characters, so since newlines aren't removed, this wouldn't fix #1888
I just looked over the changes quickly though, so maybe I missed something.

@steveniemitz
Copy link
Contributor Author

did you test the current PR

yeah, I've been running with this change since before I submitted the PR.

D's string.stripRight() .. will not remove any newline or tab characters

This is false, the Dlang docs even include newline, linefeed, and tab characters as examples:
https://dlang.org/library/std/string/strip_right.html

assert(stripRight("\n\t\v\rhello world\n\t\v\r") ==
       "\n\t\v\rhello world");

assert(stripRight([lineSep] ~ "hello world" ~ lineSep) ==
       [lineSep] ~ "hello world");

@ximion
Copy link
Collaborator

ximion commented Jan 19, 2021

Right, I even looked at the page and completely misread it...

@ximion
Copy link
Collaborator

ximion commented Jan 19, 2021

Looks good to me! Thank you for the patch!

@ximion ximion merged commit 5e7ad6b into gnunn1:master Jan 19, 2021
@steveniemitz
Copy link
Contributor Author

thank you!

@steveniemitz steveniemitz deleted the paste-strip-trailing-whitespace branch January 19, 2021 14:44
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.

Pasting command with a new-line will execute the command
2 participants