less
less copied to clipboard
8-bit CSI (Windows)
I noticed a "\x9B\xC4" sequence was removed, which was strange, since I've defined all the "extended ASCII" as text. Then I remembered that '\x9B' is the 8-bit CSI. Since Windows doesn't support that, atm I've simply done:
#if MSDOS_COMPILER
#define IS_CSI_START(c) (((LWCHAR)(c)) == ESC)
#else
#define IS_CSI_START(c) (((LWCHAR)(c)) == ESC || (((LWCHAR)(c)) == CSI))
#endif
but I'm not sure if that's really the best approach. Maybe it'd be better to test if the system/charset supports CSI?
How are you thinking that the test for CSI would work? I'm don't know how it would be possible to test for CSI support.
I thought there'd be something in terminfo for it, but apparently not; by charset I mean something like (((LWCHAR)(c)) == CSI & control_char(c)). It seems that would pretty much only be meaningful on DOS/Windows, anyway, so the compiler test sounds like the way to go, after all.
Well, this issue is a little unclear to me. It seems to me that the presence of a 0x9B CSI is related to the source of the document being viewed, rather than the system that less is running on. It seems unexpected behavior that a document containing a 0x9B CSI would appear different when viewed on a Windows system. Maybe this should be controlled by the charset selected?
Another issue is that the SGR emulation only detects 7-bit, not 8-bit. I've never come across 8-bit CSI, so I'm content with the compiler #if, which I could just add to my own build.