| 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
|
|
|
|