summaryrefslogtreecommitdiffstats
path: root/perl-install/interactive/curses.pm
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2012-04-08 13:44:23 +0000
committerPascal Terjan <pterjan@mageia.org>2012-04-08 13:44:23 +0000
commit2a59fef66b6e6fcf840911f7abe5ae5116df7ffa (patch)
tree5bba87f00bf6adc08c58be06ebccc1b88750f3e9 /perl-install/interactive/curses.pm
parent7e0fdb5fc5be257ae205f80cfec0d4b484c067f8 (diff)
downloaddrakx-2a59fef66b6e6fcf840911f7abe5ae5116df7ffa.tar
drakx-2a59fef66b6e6fcf840911f7abe5ae5116df7ffa.tar.gz
drakx-2a59fef66b6e6fcf840911f7abe5ae5116df7ffa.tar.bz2
drakx-2a59fef66b6e6fcf840911f7abe5ae5116df7ffa.tar.xz
drakx-2a59fef66b6e6fcf840911f7abe5ae5116df7ffa.zip
make sure ranges are always within limits in text mode (mga#646)
Diffstat (limited to 'perl-install/interactive/curses.pm')
-rw-r--r--perl-install/interactive/curses.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/perl-install/interactive/curses.pm b/perl-install/interactive/curses.pm
index 81e0f0459..482f14e45 100644
--- a/perl-install/interactive/curses.pm
+++ b/perl-install/interactive/curses.pm
@@ -412,6 +412,21 @@ sub create_widget {
my $width = $w->{'-sw'} - ($w->{'-vscrollbar'} ? 1 : 0);
$w->text(join("\n", _messages($width, $text)));
};
+ } elsif ($e->{type} eq 'range') {
+ $w = $win->add(undef, 'TextEntry',
+ '-sbborder' => 1,
+ '-text' => '',
+ '-regexp' => '/^\d*$/',
+ '-onchange' => sub {
+ log::l("onchange: ".$w->text);
+ $w->text($e->{min}) if $w->text < $e->{min};
+ $w->text($e->{max}) if $w->text > $e->{max};
+ ${$e->{val}} = $w->text;
+ log::l("/onchange: ".$w->text);
+ $changed->() if $changed;
+ },
+ %options);
+ $set = sub { $w->text($_[0] || '') };
} else {
$w = $win->add(undef, $e->{hidden} ? 'PasswordEntry' : 'TextEntry',
'-sbborder' => 1,