tem: add support for window manipulation functions
namely, add support for functions 8 and 18.
The window manipulation sequence is CSI Ps1 ; Ps2 ; Ps3 t. We are really interested about function 18, report terminal size in characters, but since it does use function 8 for report format, we should process 8 as well (and ignore it).
The response is sent to read queue on terminal (managed by conskbd module). Normal data stream in conskbd is using message type M_DATA, and is consisting of keyboard data. Our response, however, is ascii string and does not need translating, so we use message type M_CTL (currently unused in conskbd), and pass data directly to upstream, skipping kbtrans module.
Testing done: using this script:
#!/bin/bash stty -echo echo -en "\e[18t" # returns \e[8;??;??t IFS='[;' # shellcheck disable=SC2162 # shellcheck disable=SC2034 read -d t -s esc params # shellcheck disable=SC2086 set -- $params [[ $# = 3 && "$1" = 8 ]] && shift [[ $# != 2 ]] && echo error >&2 && exit 1 echo setting terminal to "$2x$1" >&2 stty echo rows "$1" cols "$2"
Running it, does report setting terminal dimensions correctly.