10-24-07 12:31 PM
2007-10-24, 07:17(+02), Markus Mayer:
> By the way: Is there any function that allows me to retrieve the curremt
> cursor coordinates?
[...]
On many terminals, you can send:
printf '\033[6n'
or
tput u7
Then, the terminal will reply back with:
^[[y;xR
That you can read like that:
old_settings=$(stty -g)
stty -icanon min 1 time 2 -echo
printf '\033[6n'
IFS='[;R'
set -f
set -- $(dd count=1 2> /dev/null)
stty "$old_settings"
echo "x: $3, y: $2"
--
Stéphane
[ Post a follow-up to this message ]
|