--- deliantra/Deliantra-Client/DC/MapWidget.pm 2012/11/21 13:23:10 1.168 +++ deliantra/Deliantra-Client/DC/MapWidget.pm 2012/11/26 13:14:43 1.171 @@ -703,6 +703,7 @@ my $class = shift; my $self = $class->SUPER::new ( + min_w => $::WIDTH * 0.25, # workaround for layout problems #d# bg => [0, 0, 0, 0.8], @_, ); @@ -803,6 +804,7 @@ my ($self) = @_; $self->hide; + delete $self->{command_lists}; delete $self->{command_list}; } @@ -847,6 +849,8 @@ sub update_labels { my ($self) = @_; + use sort qw(stable); + my $text = $self->{entry}->get_text; length $text @@ -865,7 +869,7 @@ if ($text =~ /^(.*?)\s+$/) { my ($cmd, $arg) = $text =~ /^\s*([^[:space:]]*)(.*)$/; - @match = ([[$cmd,'(appended whitespace suppresses completion)'],$text]); + @match = ([[$cmd,' (appended whitespace suppresses completion)'], $text]); } else { # @match is [command, penalty, command with arguments] until sort @@ -890,8 +894,8 @@ qr<$regexp> }; - for my $list (values %{ $self->{command_list} }) { - for (@$list) { + for my $list (@{ $self->{command_lists} }, "spells") { + for (@{ $self->{command_list}{$list} }) { # we only match and score if the first character matches, # so quickly rule out all others first. next unless $first_char = substr $_, 0, 1; @@ -928,19 +932,14 @@ } # Pick the best option for this command - push @match, (sort { - $b->[1] <=> $a->[1] - } @scores)[0]; + push @match, (sort { $b->[1] <=> $a->[1] } @scores)[0]; } } # @match is now [command object, command with arguments] - @match = map [$self->{command}{$_->[0]}, $_->[2]], - sort { - $b->[1] <=> $a->[1] - or $self->{command}{$a->[0]}[4] <=> $self->{command}{$b->[0]}[4] - or (length $b->[0]) <=> (length $a->[0]) - } @match; + @match = map [$_->[0], $_->[2]], + sort { $b->[1] <=> $a->[1] } + @match; } $self->{last_search} = $text; @@ -979,7 +978,7 @@ if (@labels) { $label->set_text ("$match->[1]"); - $label->set_tooltip ("$match->[0][1]"); + $label->set_tooltip ("#(command/$match->[1])"); } else { $label->set_text ("..."); $label->set_tooltip ("Use Cursor-Down to view more matches");