why 8-bit CSI cannot work in Terminal.app of macOS?

28 views Asked by At

I read the ECMA-48 document , and try to use CUB(Cursor Left).

I open my Terminal.app from my macBook Pro M3 Pro (macOS 14.2), go into nodejs repr, and type console.log("abc\u009b2\u0044d), and the ouput is "abc2Dd".

As ECMA-48 document introduces(chapter 8.3.18), representation of CUB is "CSI Pn 04/04", and representation of CSI is "09/11" or "ESC 05/11", in my case, I pick up "09/11", and this is what "\u009b" means. "2" refers to Pn, "\u0044" refers to "04/04". So the expected output should be "adc".

Then I take a try using "ESC 05/11" instead of "09/11", the representation of ESC is "01/11" (ECMA-48 document chapter 8.3.48), so I type console.log("abc\u001b\u005b2\u0044d"), and the output is "adc" as expected!

I don't understand why there is a big difference.

I just want to know the difference between "09/11" and "ESC 05/11", the two representations of CSI in ECMA-48 document.

0

There are 0 answers