zephyr_mirror: Also linewrap with extremely long strings.

(imported from commit cffa80f283fdac341942beb56ada9013cb8f7c39)
This commit is contained in:
Tim Abbott 2012-11-05 15:44:08 -05:00
parent 298ceb13a7
commit 8a870047db
1 changed files with 4 additions and 1 deletions

View File

@ -104,10 +104,13 @@ def to_zephyr_username(humbug_username):
# in the same paragraph, should have been wrapped in a way consistent
# with how the previous line was wrapped) or (2) shorter than 60
# characters (our assumed minimum linewrapping threshhold for Zephyr)
# or (3) the first word of the next line is longer than this entire
# line.
def different_paragraph(line, next_line):
words = next_line.split()
return (len(line + " " + words[0]) < len(next_line) * 0.8 or
len(line + " " + words[0]) < 60)
len(line + " " + words[0]) < 60 or
len(line) < len(words[0]))
# Linewrapping algorithm based on:
# http://gcbenison.wordpress.com/2011/07/03/a-program-to-intelligently-remove-carriage-returns-so-you-can-paste-text-without-having-it-look-awful/