Commit 0ea77d2 1 parent 9e4e7e8 commit 0ea77d2 Copy full SHA for 0ea77d2
File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -736,7 +736,10 @@ skip_numbers (const char *s)
736
736
* "control sequence", in a sort of pidgin BNF, as follows:
737
737
*
738
738
* control-seq = Esc non-'['
739
- * | Esc '[' (0 or more digits or ';' or ':' or '?') (any other char)
739
+ * | Esc '[' (parameter-byte)* (intermediate-byte)* final-byte
740
+ * parameter-byte = [\x30-\x3F] # one of "0-9;:<=>?"
741
+ * intermediate-byte = [\x20–\x2F] # one of " !\"#$%&'()*+,-./"
742
+ * final-byte = [\x40-\x7e] # one of "@A–Z[\]^_`a–z{|}~"
740
743
*
741
744
* The 256-color and true-color escape sequences should allow either ';' or ':' inside as separator,
742
745
* actually, ':' is the more correct according to ECMA-48.
@@ -763,8 +766,10 @@ strip_ctrl_codes (char *s)
763
766
if (* (++ r ) == '[' || * r == '(' )
764
767
{
765
768
/* strchr() matches trailing binary 0 */
766
- while (* (++ r ) != '\0' && strchr ("0123456789;:?" , * r ) != NULL )
769
+ while (* (++ r ) != '\0' && strchr ("0123456789;:<=> ?" , * r ) != NULL )
767
770
;
771
+ while (* r != '\0' && (* r < 0x40 || * r > 0x7E ))
772
+ ++ r ;
768
773
}
769
774
else if (* r == ']' )
770
775
{
You can’t perform that action at this time.
0 commit comments