Skip Menu |

This queue is for tickets about the Term-Screen-ReadLine CPAN distribution.

Report information
The Basics
Id: 66522
Status: resolved
Priority: 0/
Queue: Term-Screen-ReadLine

People
Owner: Nobody in particular
Requestors: BARBIE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.35
Fixed in: (no value)



Subject: overwrite rather than remove characters on initialisation
Hi I'd like to able to prevent readline from hiding characters already visible by writing spaces to the end of the given field length. As such I've created a patch to implement an additional parameter OVERWRITE, which if set to a non-zero value will allow characters to overwrite previously visible characters. Barbie.
Subject: tsr-overwrite.patch
--- Term-Screen-ReadLine-0.35/ReadLine.pm Wed Mar 3 11:23:27 2004 +++ Term-Screen-ReadLine-0.35_01/ReadLine.pm Thu Mar 10 16:48:51 2011 @@ -23,6 +23,7 @@ PASSWORD => undef, NOCOMMIT => 0, READONLY => 0, + OVERWRITE => 0, @_ }; my $row = $args->{ROW}; @@ -36,6 +37,7 @@ my $cursor = length $line; my $nocommit = $args->{NOCOMMIT}; my $readonly = $args->{READONLY}; + my $overwrite = $args->{OVERWRITE}; if (length $line == 1) { $cursor=0; } @@ -65,7 +67,7 @@ if (not defined $displayLen) { $displayLen = $args->{LEN}; } - $self->_print_line($line,$displayLen,$row,$column,$cursor,2); + $self->_print_line($line,$displayLen,$row,$column,$cursor,2,$overwrite); $exits{"013"}="enter" if not exists $exits{"013"}; $exits{"ku"}="ku" if not exists $exits{"ku"}; @@ -219,7 +221,7 @@ # sub _print_line { - my ($self, $line, $displaylen, $row, $column, $cursor, $mode) = @_; + my ($self, $line, $displaylen, $row, $column, $cursor, $mode, $overwrite) = @_; my $L; $L=length $line; @@ -244,11 +246,14 @@ if ($mode == 1 and $L > 0) { print chr(8).chr(32).chr(8); } - elsif ($mode == 2 ) {my $str; - my $i; + elsif ($mode == 2 ) { + my $str=''; + my $i; + unless($overwrite) { for(1..$displaylen-$L) { $str.=" "; } + } $self->at($row,$column)->puts($line)->puts($str); $self->at($row,$column+$L); } @@ -341,6 +346,7 @@ ONLYVALID => undef, CONVERT => undef, PASSWORD => undef, + OVERWRITE => undef, ) I<B<Parameters>> @@ -379,6 +385,12 @@ =item PASSWORD Display stars ('*') instead of what is being typed in. + +=item OVERWRITE + +By default readline will clear characters from the current position to the end +of the given field length. By setting OVERWRITE to a non-zero value will any +characters visible in the field to be overwritten rather than removed. =back
Patch has been applied