forked from ratatui/ansi-to-tui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix infinite loop on unsupported escape sequences
Despite the previous fix for screen modes, any other escape sequence not matched by the parser would still cause an infinite loop. This is a more general solution which attempts to parse most common escape codes the way a terminal would, but it is not exaustive. At the very least it guarantees the escape character will be consumed which should prevent an infinite loop even if some unexpected garbage could end up in the output text. --- I chose to eat unsupported escape codes as I believe this to be the behavior most likely expected by consumers of this library, and there are potential security ramifications of emitting control characters where developers may not be expect them. However, I do think there is an argument to be made for allowing unsupported escape sequences through for a downstream client to handle. This implementation should facilitate implementing that as an option at a later date.
- Loading branch information
1 parent
8a59123
commit 225669f
Showing
1 changed file
with
56 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters