When Ansible is executed with many bytes such as Japanese, the line feed 
position shifts as follows.

TASK [common : 日本語] 
*********************************************************
***

I created a patch to solve this.

--- /usr/lib/python2.7/dist-packages/ansible/utils/display.py.org
+++ /usr/lib/python2.7/dist-packages/ansible/utils/display.py
@@ -29,6 +29,7 @@
 import sys
 import textwrap
 import time
+import unicodedata

 from struct import unpack, pack
 from termios import TIOCGWINSZ
@@ -253,7 +254,16 @@
                 self.warning("somebody cleverly deleted cowsay or 
something during the PB run.  heh.")

         msg = msg.strip()
-        star_len = self.columns - len(msg)
+        if isinstance(msg, unicode):
+            msglen = 0
+            for c in msg:
+                if unicodedata.east_asian_width(c) in 'FWA':
+                    msglen += 2
+                else:
+                    msglen += 1
+        else:
+            msglen = len(msg)
+        star_len = self.columns - msglen
         if star_len <= 3:
             star_len = 3
         stars = u"*" * star_len

I hope you get merged into the body.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/eaff735b-a871-4ede-9d94-6880452fe3c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to