Explorar el Código

Added word wrapping for messages that don't.

root hace 4 años
padre
commit
f2ae8e0ecd
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  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",