From a70fc5c5c146f89a425000ed6361eab3b1e61b9d Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 5 Nov 2012 15:44:08 -0500 Subject: [PATCH] zephyr_mirror: Also linewrap with extremely long strings. (imported from commit cffa80f283fdac341942beb56ada9013cb8f7c39) --- bots/zephyr_mirror.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bots/zephyr_mirror.py b/bots/zephyr_mirror.py index b4e097d..f6896e8 100755 --- a/bots/zephyr_mirror.py +++ b/bots/zephyr_mirror.py @@ -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/