Certain applications send ANSI escape codes, one of those is \x1b[6n as described here: https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797. Applications sending this escape code usually expect the PTY to respond with an ANSI escape code of the current cursor position in the format of \x1b[#;#R.
As the application I called from node-pty blocks it's execution until receiving this response, I had to implement my own check. Wouldn't it be a better way, if node-pty handles such requests by itself?
I used the following onData handler with encoding set to null, to avoid any conversion errors.
term.onData((data) => {
if (data.includes("\x1b[6n")) {
term.write("\x1b[1;31R");
data = data.replace("\x1b[6n", "");
}
// continue data handling
});
Environment details
Issue description
Certain applications send ANSI escape codes, one of those is
\x1b[6n
as described here: https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797. Applications sending this escape code usually expect the PTY to respond with an ANSI escape code of the current cursor position in the format of\x1b[#;#R
.As the application I called from node-pty blocks it's execution until receiving this response, I had to implement my own check. Wouldn't it be a better way, if node-pty handles such requests by itself?
I used the following onData handler with
encoding
set to null, to avoid any conversion errors.