Terminal control/Cursor movement: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) (Added Perl example) |
|||
Line 622: | Line 622: | ||
Run["tput hpa "<>WIDTH] (* end of line *) |
Run["tput hpa "<>WIDTH] (* end of line *) |
||
Run["tput cup "<>HEIGHT<>" "<> WIDTH] (* bottom right corner *)</lang> |
Run["tput cup "<>HEIGHT<>" "<> WIDTH] (* bottom right corner *)</lang> |
||
=={{header|Perl}}== |
|||
{{trans|Perl 6}} |
|||
<lang perl>system "tput cub1"; sleep 1; # one position to the left |
|||
system "tput cuf1"; sleep 1; # one position to the right |
|||
system "tput cuu1"; sleep 1; # up one line |
|||
system "tput cud1"; sleep 1; # down one line |
|||
system "tput cr"; sleep 1; # beginning of line |
|||
system "tput home"; sleep 1; # top left corner |
|||
$_ = qx[stty -a </dev/tty 2>&1]; |
|||
my($rows,$cols) = /(\d+) rows; (\d+) col/; |
|||
$rows--; $cols--; |
|||
system "tput cup $rows $cols"; # bottom right corner |
|||
sleep 1;</lang> |
|||
=={{header|Perl 6}}== |
=={{header|Perl 6}}== |
||
<lang perl6>shell "tput cub1"; # one position to the left |
<lang perl6>shell "tput cub1"; # one position to the left |