gpt4 book ai didi

perl - 终端:我在哪里?

转载 作者:行者123 更新时间:2023-12-04 23:31:12 27 4
gpt4 key购买 nike

是否有一个变量或函数可以告诉我光标的实际位置?

#!/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?

最佳答案

您可以使用 curses反而。它有 getcurx()getcurx() .有一个CPAN module对于它(以及 Debian 或 Ubuntu 中的 libcurses-perl 包)。

关于perl - 终端:我在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4958900/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com