Skip Menu |

This queue is for tickets about the IO-Prompt CPAN distribution.

Report information
The Basics
Id: 30668
Status: open
Priority: 0/
Queue: IO-Prompt

People
Owner: Nobody in particular
Requestors: kbrint [...] rufus.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: v0.99.4
Fixed in: (no value)



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
I can confirm this issue. (Thanks, the patch totally works for me.)
Subject: Re: [rt.cpan.org #30668] IO::Prompt backspace deletes too much (or not enough)
Date: Tue, 12 May 2009 14:49:14 +1000
To: bug-IO-Prompt [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Show quoted text
> 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.
Thanks, Kevin. I've applied your patch for the next release. Damian