save & restore cursor position in perl

S

someone92

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

Jürgen Exner

someone92 said:
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
 
J

Joe Smith

someone92 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top