Support cursor visibility codes
Support cursor visibility codes; closes #16
@schneiderfelipe when I call Ansi.escape(), the first Escape object is Escape('\x1b[?25l\x1b[?7l'). It looks like this is two codes. Is that normal?
@schneiderfelipe when I call Ansi.escape(), the first Escape object is
Escape('\x1b[?25l\x1b[?7l'). It looks like this is two codes. Is that normal?
Probably a bug, likely here https://github.com/getcuia/stransi/blob/6997722fb946aa8ac732b54e3fd623f87706013a/src/stransi/ansi.py#L33-L42 or here https://github.com/getcuia/stransi/blob/6997722fb946aa8ac732b54e3fd623f87706013a/src/stransi/escape.py#L20-L22
I feel stransi doesn't work well with \x1b[?.... It would be nice to test this.
It looks like isescape should be fine; the problem is probably in escapes.
It seems like something about \x1b[?25l makes the regex not recognize the end of the code, so it detects \x1b[?7l as part of the same code.
The ? is the problem, like you thought.
>>> list(stransi.Ansi('\x1b[?25l\x1b[?7l').escapes())
[Escape('\x1b[?25l\x1b[?7l')]
>>> list(stransi.Ansi('\x1b[25l\x1b[?7l').escapes())
[Escape('\x1b[25l'), Escape('\x1b[?7l')]
I fixed the regex in 139aaca.
I'm not sure what exactly the ? means; do you know @schneiderfelipe? Now the exception it gives on the neofetch output is ValueError: invalid literal for int() with base 10: '?25'.
Okay, it looks like ? means it's a private sequence. To continue using ints, maybe we should represent codes with ? as negative ints? e.g. ?25 becomes -25
@schneiderfelipe ab339f9 uses negative ints for private sequences, so now the private codes are properly handled as unsupported codes.
Okay, I think this is ready to merge.