Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Wrong line width when used with fortune #40

Closed
WenqingZong opened this issue Jun 12, 2023 · 1 comment · Fixed by #41
Closed

[Bug Report] Wrong line width when used with fortune #40

WenqingZong opened this issue Jun 12, 2023 · 1 comment · Fixed by #41

Comments

@WenqingZong
Copy link

fsays failed to format long string when used with piped fortune.

└─(09:51:39 on wenqing ✹)──> fortune | fsays                                                                                                                                                          
 _________________________________________
/       My dear People.                         \
|       My dear Bagginses and Boffins, and my   |
| dear Tooks and Brandybucks,             |
| and Grubbs, and Chubbs, and Burrowses,  |
| and Hornblowers, and Bolgers,           |
| Bracegirdles, Goodbodies, Brockhouses   |
| and Proudfoots.  Also my good           |
| Sackville Bagginses that I welcome back |
| at last to Bag End.  Today is my        |
| one hundred and eleventh birthday: I am |
| eleventy-one today!"                    |
\               -- J. R. R. Tolkien                     /
 -----------------------------------------
        \
         \
            _~^~^~_
        \) /  o o  \ (/
          '_   -   _'
          / '-----' \
@WenqingZong WenqingZong changed the title Wrong line width when used with fortune [Bug Report] Wrong line width when used with fortune Jun 12, 2023
@WenqingZong
Copy link
Author

WenqingZong commented Jun 12, 2023

I think I figured out the reason: some fortune paragraphs contains \t, cowsay converts continues whitespaces into one space whereas fsays doesn't

minimal text to reproduce this bug:

											a								b

Note there are a lot of /ts before a and between a and b
cowsay output:

└─(16:24:43 on wenqing/fix_incorrect_width ✭)──> cat fortune6.txt | cowsay                                                                                                                  
 ______
<  a b >
 ------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

fsays output

└─(16:24:59 on wenqing/fix_incorrect_width ✭)──> cargo run -p fsays --release -- --files=fortune6.txt                                                                                       
    Finished release [optimized] target(s) in 0.00s
     Running `target/release/fsays --files=fortune6.txt`
 ____
<                                                                                       a                                                               b >
 ----
        \
         \
            _~^~^~_
        \) /  o o  \ (/
          '_   -   _'
          / '-----' \

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant