less icon indicating copy to clipboard operation
less copied to clipboard

8-bit CSI (Windows)

Open adoxa opened this issue 4 years ago • 20 comments

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?

adoxa avatar May 20 '21 01:05 adoxa

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.

gwsw avatar May 20 '21 15:05 gwsw

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.

adoxa avatar May 21 '21 00:05 adoxa

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?

gwsw avatar May 21 '21 19:05 gwsw

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.

adoxa avatar May 22 '21 02:05 adoxa