-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Magic 19 number? #39
Comments
I assume it's the max ansi escape length. |
But maybe @AlCalzone can clarify. It was added in 29f76a4. |
It's supposed to be the max. escape sequence length, essentially |
Thanks for clarifying. However, this means that if somehow the code doesn't end in an m, it just captures 19 code units and marks them as an ansi code? Even though it doesn't match the code pattern that the 19 value is derived from? Shouldn't it be considered not a code? |
Hmm I think you have a point there. |
Line 54 in a083b95
Reading the entire function is important for context. This function bails if the maximum length doesn't have an I don't see an issue with the code as-is. If you think there's an issue, I'd love to see a repro. |
Technically it consumes the entire string instead of bailing, which is probably not what @Shakeskeyboarde expects. And I think ignoring the potential escape sequence at the current location might make more sense. |
I'm not sure what you mean. It consumes the whole string (by reference...) and iterates up to 19 times over it when looking to parse the sequence. What issue are you really getting at? |
Line 79 in a083b95
In the case mentioned above, |
Ah okay. I see the point now. This is also very wrong. there's no max length. This shouldn't be constraining itself to an arbitrary length. |
A better solution would be to walk string until a terminator is reached, or an invalid character is encountered. So, match the That brings up another point. This doesn't seem to match |
That's also correct, yeah. Worth mentioning that EOF should be considered as "invalid" when trying to parse a code and whatever came before it, after and including the CSI, should still be considered an escape. It's the closest you can get to how emulators would parse it, given that they're done using state machines. |
When an ESC/CSI is found, a character is parsed in the next 19
bytesutf-16 code units:slice-ansi/index.js
Line 51 in a083b95
Why 19?
The text was updated successfully, but these errors were encountered: