typogrify icon indicating copy to clipboard operation
typogrify copied to clipboard

Fix widont newline behavior.

Open ryneeverett opened this issue 10 years ago • 4 comments

Fix #38.

Widont shouldn't count newlines as spaces. This is achieved with a regex inspired by this SO post. Rather than checking for a space (which includes newlines), we check for both (a) not not a space, and (b) not a newline.

ryneeverett avatar Oct 25 '14 20:10 ryneeverett

Thanks for the fix! I don't have time to check this right away, but I'll try and get it tested and merged this week!

chrisdrackett avatar Oct 27 '14 17:10 chrisdrackett

@mintchaos , @chrisdrackett , @justinmayer , please, review this pull request.

Thanks.

Kristinita avatar Apr 10 '17 16:04 Kristinita

@ryneeverett: Please accept my sincere apologies for the absurdly long delay in reviewing your contribution. Truly.

In my cursory review of the changed output, it does indeed seem improved when there is a newline in-between the last two words. I found a case, however, in which the presence of two spaces were previously replaced with a  , but the new regex in this PR leaves those two spaces in place. For example:

“Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.”  —Socrates

Following is how Typogrify treats the two spaces between the closing quotation mark and the em-dash above:

  • Current master: two spaces are replaced with &nbsp
  • This PR: two spaces are left untouched

That leaves me with two questions:

  1. Was this change intentional? I get the feeling that it isn't, given what the stated objective is.
  2. Is this change beneficial? I imagine not, but what do other folks think?

justinmayer avatar Nov 16 '20 11:11 justinmayer

I don't have much more insight into what I was thinking six years ago than you do. :) If that's indeed the effect then I'd agree this change is not beneficial. Feel free to close.

ryneeverett avatar Nov 16 '20 22:11 ryneeverett