Re: Get current screen location (was: Re: Terminal output with escape sequences: Any [
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Re: Get current screen location (was: Re: Terminal output with escape sequences: Any [




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Re: Get current screen location (was: Re: Terminal output with escape sequences: Any [  
Stephane CHAZELAS


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
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 ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:56 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register