From e6cb66c6cd279bdef3cfc247e9f315dd834496ae Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 17 Feb 2004 11:16:11 +0000 Subject: don't have a scroll inside a scroll which causes display pbs. alas it doesn't fix the "Tab" navigation when having a global scroll + a Listbox. You have to use the right arrow to exit the Listbox --- perl-install/interactive/newt.pm | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/perl-install/interactive/newt.pm b/perl-install/interactive/newt.pm index 79dd93eba..b08b9b0b2 100644 --- a/perl-install/interactive/newt.pm +++ b/perl-install/interactive/newt.pm @@ -97,7 +97,7 @@ sub ask_fromW { } sub ask_fromW_real { - my ($_o, $common, $l, $l2) = @_; + my ($o, $common, $l, $l2) = @_; my $ignore; #-to handle recursivity my $old_focus = -2; @@ -166,10 +166,12 @@ sub ask_fromW_real { }; $size = $count->($data_tree); - my ($h) = @l == 1 && $height > 30 ? 10 : 5; - my $scroll = $size > $h; - $has_scroll = 1; - $size = min($size, $h); + my $prefered_size = @l == 1 && $height > 30 ? 10 : 5; + my $scroll; + if ($size > $prefered_size && !$o->{no_individual_scroll}) { + $has_scroll = $scroll = 1; + $size = $prefered_size; + } $w = Newt::Component::Tree($size, $scroll); @@ -215,12 +217,15 @@ sub ask_fromW_real { 1; }; } elsif ($e->{type} =~ /list/) { - my ($h) = @l == 1 && $height > 30 ? 10 : 5; - my $scroll = @{$e->{list}} > $h ? 1 << 2 : 0; - $has_scroll = 1; - $size = min(int @{$e->{list}}, $h); + $size = @{$e->{list}}; + my ($prefered_size) = @l == 1 && $height > 30 ? 10 : 5; + my $scroll; + if ($size > $prefered_size && !$o->{no_individual_scroll}) { + $has_scroll = $scroll = 1; + $size = $prefered_size; + } - $w = Newt::Component::Listbox($size, $scroll); #- NEWT_FLAG_SCROLL + $w = Newt::Component::Listbox($size, $scroll ? 1 << 2 : 0); #- NEWT_FLAG_SCROLL my @l = map { my $t = simplify_string(may_apply($e->{format}, $_), $width - 10); @@ -280,7 +285,10 @@ sub ask_fromW_real { if (@l > 3 && $total_size > $height_avail) { $grid->GridPlace(1, 1); #- Uh?? otherwise the size allocated is bad if ($has_scroll) { - #- :'-( + #- trying again with no_individual_scroll set + $o->{no_individual_scroll} and internal_error('no_individual_scroll already set, argh...'); + $o->{no_individual_scroll} = 1; + goto &ask_fromW_real; #- same player shoot again! } $has_scroll = 1; $total_size = $height_avail; -- cgit v1.2.1