fansi icon indicating copy to clipboard operation
fansi copied to clipboard

reconsider failing on escape characters

Open smthelusive opened this issue 3 years ago • 1 comments

Hello!

I was looking at this issue for ammonite. The problem comes from fansi, because it would fail anything that contains \u001b or \u009b if that's not a part of a valid color. So, something like this will fail: fansi.Str("\u001b") I understand that this was the idea, but maybe there's no need to fail on "invalid" strings like that? If fansi can't parse it, maybe let it be part of the string? Please let me know what you think. I can also make a PR, if that makes sense.

smthelusive avatar Oct 08 '21 12:10 smthelusive

fansi is meant to let you configure what you want to do with invalid strings https://github.com/com-lihaoyi/fansi/blob/219ec0cf03d75ef5a51673fbf38209b134d4eb57/fansi/src/fansi/Fansi.scala#L256. It sounds like Ammonite just needs to turn on that option

lihaoyi avatar Dec 04 '21 12:12 lihaoyi