zephyr_mirror: Make paragraph break detection a bit less aggressive.

Because in the zephyr world, people often manually linewrap their
zephyrs, we need to relax the algorithm's assumption that every line
was wrapped to the same linewrapping threshhold.  Otherwise messages
that look like this:

aaaaa aaaaa aaaaa aaaaaaaaaa aaaaa aaaaa aaaaa aaaaa
aaaaa aaaaa aaaaa aaaaaaaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaaa
aaaaa aaaaa aaaaa aaaaaaaaaa aaaaa aaaaa aaaaa aaaaa

might be treated as a paragraph break, even though that was unlikely
to have been the sender's intention.

(imported from commit e1144da2a3efc3241a8f15b0f19fea2ea6684254)
This commit is contained in:
Tim Abbott 2012-11-05 15:01:21 -05:00
parent ee953c03fb
commit 403b728d3c

View file

@ -98,7 +98,7 @@ def to_zephyr_username(humbug_username):
def early_indent(line, next_line): def early_indent(line, next_line):
words = next_line.split() words = next_line.split()
return len(line + " " + words[0]) < len(next_line) return len(line + " " + words[0]) < len(next_line) * 0.8
# Linewrapping algorithm based on: # 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/ # http://gcbenison.wordpress.com/2011/07/03/a-program-to-intelligently-remove-carriage-returns-so-you-can-paste-text-without-having-it-look-awful/