For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > December 2004 > save & restore cursor position in perl









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author save & restore cursor position in perl
someone92

2004-12-25, 9:01 pm

I'm trying to save and restore the current position of the console's
cursor in perl on FreeBSD 4.10 using the escape sequences without
success, FreeBSD do not seems to support it.

sub savecursorpos
{
print "\x1B[sm";
}

sub restorecusorpos
{
print "\x1B[um";
}

I also tried:

sub savecursorpos
{
print "\x1B7m";
}

sub restorecusorpos
{
print "\x1B8m";
}

even tput do not work:

print `tput sc`; # Get the code to save the current cursor position
print `tput rc`;

Is there a way to do this using termcap or terminfo ? or any other
functions?
Jürgen Exner

2004-12-25, 9:01 pm

someone92 wrote:
> I'm trying to save and restore the current position of the console's
> cursor in perl on FreeBSD 4.10 using the escape sequences without
> success, FreeBSD do not seems to support it.


When talking about cursor positions usually the Curses module is the answer.
Did you check it already?

jue


Joe Smith

2004-12-29, 8:56 am

someone92 wrote:
> I'm trying to save and restore the current position of the console's
> cursor in perl on FreeBSD 4.10 using the escape sequences without
> success, FreeBSD do not seems to support it.
>
> sub savecursorpos { print "\x1B7m"; }
> sub restorecusorpos { print "\x1B8m"; }


That should be "\x1B7" and "\x1B8" (no "m" here).
Don't forget "\x1B[6n". http://www.inwap.com/pdp10/ansicode.txt

The `resize` program uses those escape sequences.
linux% script
Script started, file is typescript
% /usr/X11R6/bin/resize
% exit
linux% od -d typescript
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com