-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed
Labels
RFE 🎁Request for Enhancement, i.e. a feature requestRequest for Enhancement, i.e. a feature requestpid1util-lib
Description
Currently, the terminal size is queried with CUP/CPR pair of sequences:
CSI Ps ; Ps H
Cursor Position [row;column] (default = [1,1]) (CUP).
CSI Ps n Device Status Report (DSR).
Ps = 6 ⇒ Report Cursor Position (CPR) [row;column].
Result is CSI r ; c R
This method works, but it's rather some kind of workaround which is not ideal.
Consider using dedicated Window manipulation (XTWINOPS) sequences for that:
CSI Ps ; Ps ; Ps t
Window manipulation (XTWINOPS), dtterm, extended by xterm.Ps = 1 8 ⇒ Report the size of the text area in characters.
Result is CSI 8 ; height ; width t
or
Ps = 1 9 ⇒ Report the size of the screen in characters.
Result is CSI 9 ; height ; width t
Here is some historical background for that.
Sample script:
$ cat /usr/local/etc/profile.d/ttyS-init.sh
if [ $(tty) = /dev/ttyS0 ]; then
TERM=xterm-256color
old=$(stty -g)
stty raw -echo min 0 time 5
printf '\033[18t' > /dev/tty
IFS=';t' read -r _ rows cols _ < /dev/tty
stty "$old"
# echo "cols:$cols"
# echo "rows:$rows"
stty cols "$cols" rows "$rows"
fiReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
RFE 🎁Request for Enhancement, i.e. a feature requestRequest for Enhancement, i.e. a feature requestpid1util-lib