Public bug reported:

If one attempts the following:

echo 'Hello, World!' | toilet -w 100 --metal | cowsay -n

The speech bubble is far too wide because cowsay does not ignore the
ansi escape codes used by toilet to colorize the output. The following
patch prevnts this.

--- cowsay      2010-12-22 13:24:57.000000000 +0100
+++ cowsay      2012-07-20 13:04:49.000000000 +0200
@@ -109,7 +109,8 @@
 sub maxlength {
     my ($l, $m);
     $m = -1;
-    for my $i (@_) {
+    for my $i (each @_) {
+        $i =~ s/\033\[(\d*;)*\d*m//g;
        $l = length $i;
        $m = $l if ($l > $m);
     }

** Affects: cowsay (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1027033

Title:
  Cowsay should ignore ANSI codes in its input when determining message
  width

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cowsay/+bug/1027033/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to