Subject: | IO::Prompt backspace deletes too much (or not enough) |
When get_input receives an ERASE character on empty input, it should abort the processing
earlier. Also, when (length $echo != 1), the backspace erasure doesn't get everything.
It can be fixed by changing this:
elsif ($next eq $cntl{ERASE} and length $input) {
substr($input, -1) = "";
print {$OUT} "\b \b";
next;
}
To this:
elsif ($next eq $cntl{ERASE}) {
next unless length $input;
substr($input, -1) = "";
print {$OUT} map { $_ x length($echo) } "\b", ' ', "\b";
next;
}
I've been using this script to verify:
while (prompt '-e', '*%', "try backspace: ")
{
print "you said: $_\n";
}
Hope this helps!
kevin brintnall