Subject: | Curses::Widgets::ListBox - LISTITEMS |
Distribution: CursesWidgets-1.997
Perl-Version: This is perl, v5.8.0 built for i686-linux
OS: Linux lux 2.4.18-4GB #1 Wed Mar 27 13:57:05 UTC 2002 i686 unknown
I'm using Curses::Widgets::ListBox, and if there are no
items in the list, and I'm adding an item, then it's displayed
twice.
Code:
$listbox->setField(LISTITEMS => [], VALUE=>undef);
$listbox->draw($win,1);
[...]
$listbox->setField(LISTITEMS => [qw(a b c)], VALUE=>undef);
$listbox->draw($win,1);
then the fields displayed are:
c
a
b
c
This is probably happening because of line 218:
$pos = $#{$items} if $pos > $#{$items};
then $pos will be -1 if the list is empty.
if i add the line:
$pos = 0 if $pos < 0;
then everything works fine.