瀏覽代碼

Added word wrapping for messages that don't.

root 4 年之前
父節點
當前提交
f2ae8e0ecd
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      messages.py

+ 5 - 1
messages.py

@@ -6,6 +6,7 @@ import pendulum
 import subprocess
 import base64
 import os
+import textwrap
 
 base_path = "/messagebase"
 
@@ -183,7 +184,10 @@ def display_message(area, msgno):
             #     message["bytes"].replace(b"\r", b"\n"), msgno
             # )
         else:
-            message["text"] = message["text"].replace("\r", "\n")  # <br >\n")
+            text = message["text"].replace("\r", "\n")
+            # Ok, latest changes aren't doing word-wrap for us, so do it here.
+            text = "\n".join( [ textwrap.fill(txt, width=78, replace_whitespace=False) for txt in text.splitlines()] )
+            message["text"] = text; # message["text"].replace("\r", "\n")  # <br >\n")
 
     return render_template(
         "message.html",