terminal: where am I?
Posted
by
sid_com
on Stack Overflow
See other posts from Stack Overflow
or by sid_com
Published on 2011-02-10T15:18:11Z
Indexed on
2011/02/10
15:25 UTC
Read the original article
Hit count: 176
Is there a variable or a function, which can tell me the actual position of the cursor?
#!/usr/bin/env perl
use warnings;
use 5.012;
use Term::ReadKey;
use Term::Cap;
use POSIX;
my( $col, $row ) = GetTerminalSize();
my $termios = new POSIX::Termios;
$termios->getattr;
my $ospeed = $termios->getospeed;
my $terminal = Tgetent Term::Cap { TERM => undef, OSPEED => $ospeed };
# some movement ...
# at which position (x/y) is the cursor now?
© Stack Overflow or respective owner