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(fmt): ascii art is broken apart #4371

Closed
2 tasks done
PaulRBerg opened this issue Feb 16, 2023 · 9 comments · Fixed by #4554
Closed
2 tasks done

bug(fmt): ascii art is broken apart #4371

PaulRBerg opened this issue Feb 16, 2023 · 9 comments · Fixed by #4554
Labels
C-forge Command: forge Cmd-forge-fmt Command: forge fmt T-bug Type: bug

Comments

@PaulRBerg
Copy link
Contributor

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

No response

What command(s) is the bug in?

forge fmt

Operating System

macOS (Apple Silicon)

Describe the bug

I generated the following ASCII art with textfancy.com (specifically, the "Dark with shadow" font):

/*

██████╗ ██████╗ ██████╗ ████████╗███████╗███████╗████████╗
██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝
██████╔╝██████╔╝██████╔╝   ██║   █████╗  ███████╗   ██║   
██╔═══╝ ██╔══██╗██╔══██╗   ██║   ██╔══╝  ╚════██║   ██║   
██║     ██║  ██║██████╔╝   ██║   ███████╗███████║   ██║   
╚═╝     ╚═╝  ╚═╝╚═════╝    ╚═╝   ╚══════╝╚══════╝   ╚═╝   

*/

Running forge fmt messes this up:

/*

██████╗ ██████╗ ██████╗
████████╗███████╗███████╗████████╗
██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝
██████╔╝██████╔╝██████╔╝   ██║   █████╗  ███████╗   ██║
██╔═══╝ ██╔══██╗██╔══██╗   ██║   ██╔══╝  ╚════██║   ██║
██║     ██║  ██║██████╔╝   ██║   ███████╗███████║   ██║
╚═╝     ╚═╝  ╚═╝╚═════╝    ╚═╝   ╚══════╝╚══════╝   ╚═╝

*/
@PaulRBerg
Copy link
Contributor Author

PaulRBerg commented Feb 25, 2023

For some reason, this bug seems to affect only the "E", "S", and "T" letters 🤔

"PRBPROXY" works fine:

/*

██████╗ ██████╗ ██████╗ ██████╗ ██████╗  ██████╗ ██╗  ██╗██╗   ██╗
██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔═══██╗╚██╗██╔╝╚██╗ ██╔╝
██████╔╝██████╔╝██████╔╝██████╔╝██████╔╝██║   ██║ ╚███╔╝  ╚████╔╝
██╔═══╝ ██╔══██╗██╔══██╗██╔═══╝ ██╔══██╗██║   ██║ ██╔██╗   ╚██╔╝
██║     ██║  ██║██████╔╝██║     ██║  ██║╚██████╔╝██╔╝ ██╗   ██║
╚═╝     ╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═╝   ╚═╝

*/

@mds1
Copy link
Collaborator

mds1 commented Feb 25, 2023

Tried reproducing on the latest forge with a fresh project using the default fmt settings and was not able to reproduce. After running forge fmt I still have this:

/*

██████╗ ██████╗ ██████╗ ██████╗ ██████╗  ██████╗ ██╗  ██╗██╗   ██╗
██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔═══██╗╚██╗██╔╝╚██╗ ██╔╝
██████╔╝██████╔╝██████╔╝██████╔╝██████╔╝██║   ██║ ╚███╔╝  ╚████╔╝
██╔═══╝ ██╔══██╗██╔══██╗██╔═══╝ ██╔══██╗██║   ██║ ██╔██╗   ╚██╔╝
██║     ██║  ██║██████╔╝██║     ██║  ██║╚██████╔╝██╔╝ ██╗   ██║
╚═╝     ╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═╝   ╚═╝
*/

/*

██████╗ ██████╗ ██████╗ ████████╗███████╗███████╗████████╗
██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝
██████╔╝██████╔╝██████╔╝   ██║   █████╗  ███████╗   ██║
██╔═══╝ ██╔══██╗██╔══██╗   ██║   ██╔══╝  ╚════██║   ██║
██║     ██║  ██║██████╔╝   ██║   ███████╗███████║   ██║
╚═╝     ╚═╝  ╚═╝╚═════╝    ╚═╝   ╚══════╝╚══════╝   ╚═╝
*/

@mds1 mds1 added C-forge Command: forge Cmd-forge-fmt Command: forge fmt labels Feb 25, 2023
@mattsse
Copy link
Member

mattsse commented Feb 25, 2023

this looks like a trailing new line @rkrasiuk ?

@PaulRBerg
Copy link
Contributor Author

PaulRBerg commented Feb 25, 2023

Thanks for taking a look, @mds1.

You will be able to reproduce this by applying my fmt config. I just tested it on a fresh new project generated via forge init, and I was able to reproduce the behavior reported in the OP.

@mds1
Copy link
Collaborator

mds1 commented Feb 25, 2023

Ah yes that reproduced it, seems the wrap_comments = true is the culprit, which is odd because the comments are not exceeding the line width


Also, using the default config, subsequent invocations continue to modify the content.

Initial:

/*

██████╗ ██████╗ ██████╗ ████████╗███████╗███████╗████████╗
██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝
██████╔╝██████╔╝██████╔╝   ██║   █████╗  ███████╗   ██║   
██╔═══╝ ██╔══██╗██╔══██╗   ██║   ██╔══╝  ╚════██║   ██║   
██║     ██║  ██║██████╔╝   ██║   ███████╗███████║   ██║   
╚═╝     ╚═╝  ╚═╝╚═════╝    ╚═╝   ╚══════╝╚══════╝   ╚═╝   

*/

First forge fmt (the */ moves up a line):

/*

██████╗ ██████╗ ██████╗ ████████╗███████╗███████╗████████╗
██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝
██████╔╝██████╔╝██████╔╝   ██║   █████╗  ███████╗   ██║
██╔═══╝ ██╔══██╗██╔══██╗   ██║   ██╔══╝  ╚════██║   ██║
██║     ██║  ██║██████╔╝   ██║   ███████╗███████║   ██║
╚═╝     ╚═╝  ╚═╝╚═════╝    ╚═╝   ╚══════╝╚══════╝   ╚═╝
*/

Second forge fmt (the */ moved up another line):

/*

██████╗ ██████╗ ██████╗ ████████╗███████╗███████╗████████╗
██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝
██████╔╝██████╔╝██████╔╝   ██║   █████╗  ███████╗   ██║
██╔═══╝ ██╔══██╗██╔══██╗   ██║   ██╔══╝  ╚════██║   ██║
██║     ██║  ██║██████╔╝   ██║   ███████╗███████║   ██║
╚═╝     ╚═╝  ╚═╝╚═════╝    ╚═╝   ╚══════╝╚══════╝   ╚═╝*/

@PaulRBerg
Copy link
Contributor Author

Update - I had my VSCode settings misconfigured above when I said that forge fmt works well for the PRBProxy ASCII art. It doesn't, actually:

/*

██████╗ ██████╗ ██████╗ ██████╗ ██████╗  ██████╗
██╗  ██╗██╗   ██╗
██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔═══██╗╚██╗██╔╝╚██╗
██╔╝
██████╔╝██████╔╝██████╔╝██████╔╝██████╔╝██║   ██║
╚███╔╝  ╚████╔╝
██╔═══╝ ██╔══██╗██╔══██╗██╔═══╝
██╔══██╗██║   ██║ ██╔██╗   ╚██╔╝
██║     ██║  ██║██████╔╝██║     ██║  ██║╚██████╔╝██╔╝
██╗   ██║
╚═╝     ╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝  ╚═╝ ╚═════╝
╚═╝  ╚═╝   ╚═╝
*/

@PaulRBerg
Copy link
Contributor Author

PaulRBerg commented Mar 13, 2023

Hey @rkrasiuk, any chance you could take a look at this to see if it's an easy fix?

Sorry to pester you! Getting ready for an audit with a few projects, and I'd love to be able to switch to forge fmt. I think I can go around #4450, but I can't go around an ugly piece of ASCII art :D

@rkrasiuk
Copy link
Collaborator

@PaulRBerg taking a look today

@rkrasiuk
Copy link
Collaborator

the infamous len vs len issue lol. str::len in rust returns the length of bytes as opposed to number of chars

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge Cmd-forge-fmt Command: forge fmt T-bug Type: bug
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants