+ different keyboard modes causing the same key press to be presented by different ANSI escape sequences
+ different TTY states (eg local echo)
+ different OSs having subtly different syscalls for changing TTY states
+ differing support for terminal emulation (most these days roughly emulate xterm, but even there, none aim for 100% be compatibility)
+ a lack of a consensus on how to check for features provided by a terminal (some use ANSI escape sequences and wait for an ansi sequence to be returned from the term (that’s how the old VTs worked), some check $TERM (that’s how the first wave of terminal emulation was detected), some terms expose themselves as xterm and ignore the VT feature sequences, but set other env vars. it’s honestly a bigger mess than the user-agent string.
…and this is assuming a POSIX system. Things get doubly interesting when you throw Windows into the mix
+ wide characters
+ different keyboard modes causing the same key press to be presented by different ANSI escape sequences
+ different TTY states (eg local echo)
+ different OSs having subtly different syscalls for changing TTY states
+ differing support for terminal emulation (most these days roughly emulate xterm, but even there, none aim for 100% be compatibility)
+ a lack of a consensus on how to check for features provided by a terminal (some use ANSI escape sequences and wait for an ansi sequence to be returned from the term (that’s how the old VTs worked), some check $TERM (that’s how the first wave of terminal emulation was detected), some terms expose themselves as xterm and ignore the VT feature sequences, but set other env vars. it’s honestly a bigger mess than the user-agent string.
…and this is assuming a POSIX system. Things get doubly interesting when you throw Windows into the mix