piuccio / cowsay

cowsay is a configurable talking cow
Other
1.15k stars 162 forks source link

Word wrap #56

Open jcubic opened 4 years ago

jcubic commented 4 years ago

I use you library as demo for jQuery Terminal and it seems that it don't wrap word properly,

type this:

echo There is in the worst of fortunes the best change of a happy ending. | say

the output is:

 __________________________________________
/ There is in the worst of fortunes the be \
\ st change of a happy ending.             /
 ------------------------------------------
        \   ^__^
         \  (oO)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

but native cowsay prints:

 _______________________________________
/ There is in the worst of fortunes the \
\ best change of a happy ending.        /
 ---------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

As you can see best is never broken into two words. If you will accept PR I can check if I can fix this.

jcubic commented 3 years ago

It's been almost a year and no even a single comment. Do you accept PR?

MarketingPip commented 2 months ago

@jcubic - did you every make a fix for this? It also seems to mess up due to string-width library not detecting ANSI codes. (Which it can when set).

jcubic commented 2 months ago

No, I was not even checking the code.

MarketingPip commented 2 months ago

@jcubic - fair enough. If you ever take a jab at this do lmk.

ps; I made a pr on the lolcat module you published. Would love to work with you on something / together in future. As my library is heavily inspired by yours in my organization. ie; Termino.js