Use readline::gnu instead of readline::ttytter. A few weird bugs left to go, but I'm pretty sure we're close to going public.
This commit is contained in:
+31
-48
@@ -113,7 +113,7 @@ BEGIN {
|
||||
# verbose=0 # Show debug information
|
||||
# superverbose=0 # Even more debug information
|
||||
# silent=0 # Reduce output messages
|
||||
# readline=1 # Use readline for input (if available)
|
||||
# readline=0 # Disable readline for input (enabled by default)
|
||||
# readlinerepaint=0 # Repaint readline on signals
|
||||
# vcheck=1 # Check for updates on startup
|
||||
# noprompt=0 # Disable interactive prompts
|
||||
@@ -496,14 +496,29 @@ EOF
|
||||
# try to init Term::ReadLine if it was requested
|
||||
# (shakes fist at @br3nda, it's all her fault)
|
||||
%readline_completion = ();
|
||||
$readline = 1 if (!defined $readline); # Enable readline by default
|
||||
print STDOUT "-- DEBUG: readline=$readline, silent=$silent, script=$script\n" if ($verbose);
|
||||
if ($readline && !$silent && !$script) {
|
||||
$ENV{"PERL_RL"} = "TTYverse" if (!length($ENV{'PERL_RL'}));
|
||||
$ENV{"PERL_RL"} = "Gnu" if (!length($ENV{'PERL_RL'}));
|
||||
print STDOUT "-- DEBUG: PERL_RL set to: $ENV{'PERL_RL'}\n" if ($verbose);
|
||||
print STDOUT "-- DEBUG: TERM environment: $ENV{'TERM'}\n" if ($verbose);
|
||||
eval
|
||||
'use Term::ReadLine; $termrl = new Term::ReadLine ("TTYverse", \*STDIN, \*STDOUT)'
|
||||
|| die(
|
||||
"$@\nthis perl doesn't have ReadLine. don't use -readline.\n");
|
||||
$stdout = $termrl->OUT || \*STDOUT;
|
||||
$stdin = $termrl->IN || \*STDIN;
|
||||
'use Term::ReadLine; $termrl = new Term::ReadLine ("TTYverse", \*STDIN, \*STDOUT)';
|
||||
if ($@) {
|
||||
print STDOUT "-- ReadLine not available, disabling readline features\n" if ($verbose);
|
||||
$readline = 0;
|
||||
$termrl = undef;
|
||||
} else {
|
||||
$stdout = $termrl->OUT || \*STDOUT;
|
||||
$stdin = $termrl->IN || \*STDIN;
|
||||
print $stdout "-- DEBUG: ReadLine implementation: " . $termrl->ReadLine . "\n" if ($verbose);
|
||||
print $stdout "-- DEBUG: ReadLine features: " . join(", ", $termrl->Features) . "\n" if ($verbose);
|
||||
}
|
||||
}
|
||||
if (!$readline || $silent || $script || !$termrl) {
|
||||
$stdout = \*STDOUT;
|
||||
$stdin = \*STDIN;
|
||||
} else {
|
||||
$readline = '' if ($readline eq '1');
|
||||
$readline =~ s/^"//; # for optimizer
|
||||
$readline =~ s/"$//;
|
||||
@@ -512,9 +527,6 @@ EOF
|
||||
%original_readline = %readline_completion;
|
||||
# readline repaint can't be tested here. we cache our
|
||||
# result later.
|
||||
} else {
|
||||
$stdout = \*STDOUT;
|
||||
$stdin = \*STDIN;
|
||||
}
|
||||
$wrapseq = 0;
|
||||
$lastlinelength = -1;
|
||||
@@ -619,18 +631,9 @@ EOF
|
||||
eval 'use POSIX; $termios = new POSIX::Termios;';
|
||||
print $stdout "-- termios test: $termios\n" if ($verbose);
|
||||
|
||||
# check the TRLT version. versions < 1.3 won't work with 2.0.
|
||||
if ($termrl && $termrl->ReadLine eq 'Term::ReadLine::TTYverse') {
|
||||
eval '$trlv = $termrl->Version;';
|
||||
die (<<"EOF") if (length($trlv) && 0+$trlv < 1.3);
|
||||
*** death permeates me ***
|
||||
you need to upgrade your Term::ReadLine::TTYverse to at least version 1.3
|
||||
to use TTYverse 2.x, or bad things will happen such as signal mismatches,
|
||||
unexpected quits, and dogs and cats living peacefully in the same house.
|
||||
|
||||
EOF
|
||||
print $stdout "** t.co support needs Term::ReadLine:TTYverse 1.4+ (-notco to ignore)\n"
|
||||
if (length($trlv) && !$notco && 0+$trlv < 1.4);
|
||||
# Term::ReadLine::Gnu is well-maintained and compatible
|
||||
if ($termrl && $termrl->ReadLine eq 'Term::ReadLine::Gnu') {
|
||||
print $stdout "-- using Term::ReadLine::Gnu for enhanced readline support\n" if ($verbose);
|
||||
}
|
||||
|
||||
# try to get signal numbers for SIG* from POSIX. use internals if failed.
|
||||
@@ -1893,7 +1896,12 @@ sub defaultmain {
|
||||
$tco_sub = sub { return &main::fastturntotco(shift); };
|
||||
eval '$termrl->hook_no_tco';
|
||||
if ($termrl) {
|
||||
print $stdout "-- DEBUG: Starting readline loop with implementation: " . $termrl->ReadLine . "\n" if ($verbose);
|
||||
print $stdout "-- DEBUG: Terminal capability check - can cursor move: " . ($termrl->can('Attribs') ? "yes" : "no") . "\n" if ($verbose);
|
||||
while(defined ($_ = $termrl->readline((&$prompt(1))[0]))) {
|
||||
if ($verbose && /[\x1b\[\x5b]/) {
|
||||
print $stdout "-- DEBUG: Arrow key detected in input: " . join("", map { sprintf("\\x%02x", ord($_)) } split(//, $_)) . "\n";
|
||||
}
|
||||
kill $SIGUSR1, $child; # suppress output
|
||||
$rv = &prinput($_);
|
||||
kill $SIGUSR2, $child; # resume output
|
||||
@@ -8128,32 +8136,7 @@ sub updatecheck {
|
||||
my $latest_version = '';
|
||||
|
||||
|
||||
if ($termrl && $termrl->ReadLine eq 'Term::ReadLine::TTYverse') {
|
||||
my $trlv = $termrl->Version;
|
||||
print $stdout
|
||||
"-- checking Term::ReadLine::TTYverse version: $vrlcheck_url\n";
|
||||
$vvs = `$simple_agent $vrlcheck_url`;
|
||||
print $stdout "-- server response: $vvs\n" if ($verbose);
|
||||
($vvs, $s1, $s2, $s3) = split(/--__--\n/s, $vvs);
|
||||
$s1 = undef if ($s1 !~ /^\*/) ;
|
||||
$s2 = undef if ($s2 !~ /^\*/) ;
|
||||
$s3 = undef if ($s3 !~ /^\*/) ;
|
||||
chomp($vvs);
|
||||
# right now we're only using $inversion (no betas/rcs).
|
||||
($tverify, $inversion, $bversion, $rcnum, $download,
|
||||
$bdownload) = split(/;/, $vvs, 6);
|
||||
if ($tverify ne 'trlt') {
|
||||
$vs .= "-- warning: unable to verify Term::ReadLine::TTYverse version\n";
|
||||
} else {
|
||||
if ($trlv < 0+$inversion) {
|
||||
$vs .= "** NEW Term::ReadLine::TTYverse VERSION AVAILABLE: $inversion **\n" .
|
||||
"** GET IT: $download\n";
|
||||
$update_trlt = $download;
|
||||
} else {
|
||||
$vs .= "-- your version of Term::ReadLine::TTYverse is up to date ($trlv)\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
# Term::ReadLine::Gnu doesn't need version checking - it's maintained on CPAN
|
||||
|
||||
print $stdout "-- checking TTYverse version...\n";
|
||||
# Git-based version checking - no longer using remote URL
|
||||
|
||||
Reference in New Issue
Block a user