ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/MapWidget.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/MapWidget.pm (file contents):
Revision 1.135 by root, Sun Jul 20 02:51:40 2008 UTC vs.
Revision 1.150 by elmex, Wed Aug 12 18:41:39 2009 UTC

11use DC::Macro; 11use DC::Macro;
12 12
13our @ISA = DC::UI::Base::; 13our @ISA = DC::UI::Base::;
14 14
15my $magicmap_tex = 15my $magicmap_tex =
16 new_from_file DC::Texture DC::find_rcfile "magicmap.png", 16 new_from_resource DC::Texture "magicmap.png",
17 mipmap => 1, wrap => 0, internalformat => GL_ALPHA; 17 mipmap => 1, wrap => 0, internalformat => GL_ALPHA;
18 18
19sub new { 19sub new {
20 my $class = shift; 20 my $class = shift;
21 21
163sub invoke_button_down { 163sub invoke_button_down {
164 my ($self, $ev, $x, $y) = @_; 164 my ($self, $ev, $x, $y) = @_;
165 165
166 if ($ev->{button} == 1) { 166 if ($ev->{button} == 1) {
167 $self->grab_focus; 167 $self->grab_focus;
168 return unless $::CONN; 168 return unless $::CONN && $self->{ctilesize};
169 169
170 my $x = $self->{dx} + DC::floor +($ev->{x} - $self->{sx0}) / $self->{ctilesize}; 170 my $x = $self->{dx} + DC::floor +($ev->{x} - $self->{sx0}) / $self->{ctilesize};
171 my $y = $self->{dy} + DC::floor +($ev->{y} - $self->{sy0}) / $self->{ctilesize}; 171 my $y = $self->{dy} + DC::floor +($ev->{y} - $self->{sy0}) / $self->{ctilesize};
172 172
173 $x -= DC::floor $::MAP->w * 0.5; 173 $x -= DC::floor $::MAP->w * 0.5;
201 ["Skills\tF3", sub { ::toggle_player_page ($::SKILL_PAGE) }], 201 ["Skills\tF3", sub { ::toggle_player_page ($::SKILL_PAGE) }],
202 ["Spells…\tF4", sub { ::toggle_player_page ($::SPELL_PAGE) }], 202 ["Spells…\tF4", sub { ::toggle_player_page ($::SPELL_PAGE) }],
203 ["Inventory…\tF5", sub { ::toggle_player_page ($::INVENTORY_PAGE) }], 203 ["Inventory…\tF5", sub { ::toggle_player_page ($::INVENTORY_PAGE) }],
204 ["Setup… \tF9", sub { $::SETUP_DIALOG->toggle_visibility }], 204 ["Setup… \tF9", sub { $::SETUP_DIALOG->toggle_visibility }],
205# ["Server Messages…", sub { $::MESSAGE_WINDOW->toggle_visibility }], 205# ["Server Messages…", sub { $::MESSAGE_WINDOW->toggle_visibility }],
206 [
207 $::PICKUP_ENABLE->{state}
208 ? "Disable automatic pickup"
209 : "Enable automatic pickup",
210 sub { $::PICKUP_ENABLE->toggle }
211 ],
212 ); 206 );
213 207
214 if ($::CONN && $::CONN->{editor_support}) { 208 if ($::CONN && $::CONN->{editor_support}) {
215# push @items, [ 209# push @items, [
216# "Edit this map <span size='xx-small'>(" . (DC::asxml $::CONN->{map_info}[0]) . ")</span>", 210# "Edit this map <span size='xx-small'>(" . (DC::asxml $::CONN->{map_info}[0]) . ")</span>",
285 $self->{need_update} = 1; 279 $self->{need_update} = 1;
286 $self->SUPER::update; 280 $self->SUPER::update;
287} 281}
288 282
289my %DIR = ( 283my %DIR = (
290 ( "," . DC::SDLK_KP5 ), [0, "stay fire"], 284 ( "," . DC::SDLK_KP5 ), [0, "stay fire"],
291 ( "," . DC::SDLK_KP8 ), [1, "north"], 285 ( "," . DC::SDLK_KP8 ), [1, "north"],
292 ( "," . DC::SDLK_KP9 ), [2, "northeast"], 286 ( "," . DC::SDLK_KP9 ), [2, "northeast"],
293 ( "," . DC::SDLK_KP6 ), [3, "east"], 287 ( "," . DC::SDLK_KP6 ), [3, "east"],
294 ( "," . DC::SDLK_KP3 ), [4, "southeast"], 288 ( "," . DC::SDLK_KP3 ), [4, "southeast"],
295 ( "," . DC::SDLK_KP2 ), [5, "south"], 289 ( "," . DC::SDLK_KP2 ), [5, "south"],
296 ( "," . DC::SDLK_KP1 ), [6, "southwest"], 290 ( "," . DC::SDLK_KP1 ), [6, "southwest"],
297 ( "," . DC::SDLK_KP4 ), [7, "west"], 291 ( "," . DC::SDLK_KP4 ), [7, "west"],
298 ( "," . DC::SDLK_KP7 ), [8, "northwest"], 292 ( "," . DC::SDLK_KP7 ), [8, "northwest"],
299 293
294 ( "," . DC::SDLK_PAGEUP ), [2, "northeast"],
295 ( "," . DC::SDLK_PAGEDOWN ), [4, "southeast"],
296 ( "," . DC::SDLK_END ), [6, "southwest"],
297 ( "," . DC::SDLK_HOME ), [8, "northwest"],
298
300 ( "," . DC::SDLK_UP ), [1, "north"], 299 ( "," . DC::SDLK_UP ), [1, "north"],
301 ("1," . DC::SDLK_UP ), [2, "northeast"], 300 ("1," . DC::SDLK_UP ), [2, "northeast"],
302 ( "," . DC::SDLK_RIGHT), [3, "east"], 301 ( "," . DC::SDLK_RIGHT ), [3, "east"],
303 ("1," . DC::SDLK_RIGHT), [4, "southeast"], 302 ("1," . DC::SDLK_RIGHT ), [4, "southeast"],
304 ( "," . DC::SDLK_DOWN ), [5, "south"], 303 ( "," . DC::SDLK_DOWN ), [5, "south"],
305 ("1," . DC::SDLK_DOWN ), [6, "southwest"], 304 ("1," . DC::SDLK_DOWN ), [6, "southwest"],
306 ( "," . DC::SDLK_LEFT ), [7, "west"], 305 ( "," . DC::SDLK_LEFT ), [7, "west"],
307 ("1," . DC::SDLK_LEFT ), [8, "northwest"], 306 ("1," . DC::SDLK_LEFT ), [8, "northwest"],
308); 307);
309 308
310sub invoke_key_down { 309sub invoke_key_down {
311 my ($self, $ev) = @_; 310 my ($self, $ev) = @_;
312 311
313 my $mod = $ev->{mod}; 312 my $mod = $ev->{mod};
314 my $sym = $ev->{sym}; 313 my $sym = $ev->{sym};
315 my $uni = $ev->{unicode}; 314 my $uni = $ev->{unicode};
316 315
317 $mod &= DC::KMOD_CTRL | DC::KMOD_ALT | DC::KMOD_SHIFT; 316 $mod &= DC::KMOD_CTRL | DC::KMOD_ALT | DC::KMOD_META | DC::KMOD_SHIFT;
318 317
319 # ignore repeated keypresses 318 # ignore repeated keypresses
320 return if $self->{last_mod} == $mod && $self->{last_sym} == $sym; 319 return if $self->{last_mod} == $mod && $self->{last_sym} == $sym;
321 $self->{last_mod} = $mod; 320 $self->{last_mod} = $mod;
322 $self->{last_sym} = $sym; 321 $self->{last_sym} = $sym;
323 322
324 if ($::CONN && (my $dir = $DIR{(!!($mod & DC::KMOD_ALT)) . ",$sym"})) { 323 my $dir = $DIR{ (!!($mod & (DC::KMOD_ALT | DC::KMOD_META))) . ",$sym" };
324
325 if ($::CONN && $dir) {
325 if ($mod & DC::KMOD_SHIFT) { 326 if ($mod & DC::KMOD_SHIFT) {
326 $self->{shft}++; 327 $self->{shft}++;
327 if ($dir->[0] != $self->{fire_dir}) { 328 if ($dir->[0] != $self->{fire_dir}) {
328 $::CONN->user_send ("fire $dir->[0]"); 329 $::CONN->user_send ("fire $dir->[0]");
329 } 330 }
356 $::CONN->user_send ("fire_stop"); 357 $::CONN->user_send ("fire_stop");
357 delete $self->{fire_dir}; 358 delete $self->{fire_dir};
358 $res = 1; 359 $res = 1;
359 } 360 }
360 } else { 361 } else {
361 if (exists $DIR{(!!($mod & DC::KMOD_ALT)) . ",$sym"} && delete $self->{shft}) { 362 my $dir = $DIR{ (!!($mod & (DC::KMOD_ALT | DC::KMOD_META))) . ",$sym" };
363
364 if ($dir && delete $self->{shft}) {
362 $::CONN->user_send ("fire_stop"); 365 $::CONN->user_send ("fire_stop");
363 delete $self->{fire_dir}; 366 delete $self->{fire_dir};
364 $res = 1; 367 $res = 1;
365 } elsif (($sym == DC::SDLK_LSHIFT || $sym == DC::SDLK_RSHIFT) 368 } elsif (($sym == DC::SDLK_LSHIFT || $sym == DC::SDLK_RSHIFT)
366 && delete $self->{shft}) { # XXX: is RSHIFT ok? 369 && delete $self->{shft}) { # XXX: is RSHIFT ok?
368 delete $self->{fire_dir}; 371 delete $self->{fire_dir};
369 $res = 1; 372 $res = 1;
370 } 373 }
371 } 374 }
372 375
373 if (!($mod & DC::KMOD_CTRL ) && delete $self->{ctrl}) { 376 if (!($mod & DC::KMOD_CTRL) && delete $self->{ctrl}) {
374 $::CONN->user_send ("run_stop"); 377 $::CONN->user_send ("run_stop");
375 $res = 1; 378 $res = 1;
376 } 379 }
377 380
378 $res 381 $res
421 if ($self->{sdx} || $self->{sdy}) { 424 if ($self->{sdx} || $self->{sdy}) {
422 my $diff = EV::time - ($self->{last_update} || $::LAST_REFRESH); 425 my $diff = EV::time - ($self->{last_update} || $::LAST_REFRESH);
423 my $spd = $::CONN->{stat}{DC::Protocol::CS_STAT_SPEED}; 426 my $spd = $::CONN->{stat}{DC::Protocol::CS_STAT_SPEED};
424 427
425 # the minimum time for a single tile movement 428 # the minimum time for a single tile movement
426 my $mintime = DC::Protocol::TICK * DC::ceil 1 / ($spd * DC::Protocol::TICK); 429 my $mintime = DC::Protocol::TICK * DC::ceil 1 / ($spd * DC::Protocol::TICK || 1);
430
431 $spd *= $self->{tilesize};
427 432
428 # jump if "impossibly high" speed 433 # jump if "impossibly high" speed
429 if ( 434 if (
430 (max abs $self->{sdx}, abs $self->{sdy}) 435 (max abs $self->{sdx}, abs $self->{sdy})
431 > $spd * $self->{tilesize} * $mintime * 1.1 436 > $spd * $mintime * 2.1
432 ) { 437 ) {
433 #warn "jump ", (max abs $self->{sdx}, abs $self->{sdy}), " ", $spd * $mintime * 1.0;#d# 438 #warn "jump ", (max abs $self->{sdx}, abs $self->{sdy}), " ", $spd * $mintime * 2.1;#d#
434 $self->{sdx} = $self->{sdy} = 0; 439 $self->{sdx} = $self->{sdy} = 0;
435 } else { 440 } else {
436 $spd *= $self->{tilesize} * $diff * 1.0001; # 1.0001 so that we don't accumulate rounding errors the wrong direction 441 $spd *= $diff * 1.0001; # 1.0001 so that we don't accumulate rounding errors the wrong direction
437 442
438 my $dx = $self->{sdx} < 0 ? -$spd : $spd; 443 my $dx = $self->{sdx} < 0 ? -$spd : $spd;
439 my $dy = $self->{sdy} < 0 ? -$spd : $spd; 444 my $dy = $self->{sdy} < 0 ? -$spd : $spd;
440 445
441 if ($self->{sdx} * ($self->{sdx} - $dx) <= 0) { $self->{sdx} = 0 } else { $self->{sdx} -= $dx } 446 if ($self->{sdx} * ($self->{sdx} - $dx) <= 0) { $self->{sdx} = 0 } else { $self->{sdx} -= $dx }
442 if ($self->{sdy} * ($self->{sdy} - $dy) <= 0) { $self->{sdy} = 0 } else { $self->{sdy} -= $dy } 447 if ($self->{sdy} * ($self->{sdy} - $dy) <= 0) { $self->{sdy} = 0 } else { $self->{sdy} -= $dy }
443
444 $self->update;
445 } 448 }
449
450 $self->update;
446 } 451 }
447 } else { 452 } else {
448 $self->{sdx} = $self->{sdy} = 0; 453 $self->{sdx} = $self->{sdy} = 0;
449 } 454 }
450 455
458 if (delete $self->{need_update}) { 463 if (delete $self->{need_update}) {
459 $self->movement_update; 464 $self->movement_update;
460 465
461 my $tilesize = $self->{ctilesize} = (int $self->{tilesize} * $::CFG->{map_scale}) || 1; 466 my $tilesize = $self->{ctilesize} = (int $self->{tilesize} * $::CFG->{map_scale}) || 1;
462 467
468 my $sdx_t = DC::ceil $self->{sdx} / $tilesize;
469 my $sdy_t = DC::ceil $self->{sdy} / $tilesize;
470
463 # width/height of map, in tiles 471 # width/height of map, in tiles
464 my $sw = $self->{sw} = 1 + DC::ceil $self->{w} / $tilesize; 472 my $sw = $self->{sw} = 2 + DC::ceil $self->{w} / $tilesize;
465 my $sh = $self->{sh} = 1 + DC::ceil $self->{h} / $tilesize; 473 my $sh = $self->{sh} = 2 + DC::ceil $self->{h} / $tilesize;
466 474
467 # the map displacement, in tiles 475 # the map displacement, in tiles
468 my $sx = DC::ceil $::CFG->{map_shift_x} / $tilesize + $self->{sdx} / $self->{tilesize}; 476 my $sx = DC::ceil $::CFG->{map_shift_x} / $tilesize + $sdx_t;
469 my $sy = DC::ceil $::CFG->{map_shift_y} / $tilesize + $self->{sdy} / $self->{tilesize}; 477 my $sy = DC::ceil $::CFG->{map_shift_y} / $tilesize + $sdy_t;
470 478
471 # the upper left "visible" corner, in pixels 479 # the upper left "visible" corner, in pixels
472 my $sx0 = $self->{sx0} = $::CFG->{map_shift_x} - $sx * $tilesize; 480 my $sx0 = $self->{sx0} = $::CFG->{map_shift_x} - $sx * $tilesize;
473 my $sy0 = $self->{sy0} = $::CFG->{map_shift_y} - $sy * $tilesize; 481 my $sy0 = $self->{sy0} = $::CFG->{map_shift_y} - $sy * $tilesize;
474 482
475 my $dx = $self->{dx} = DC::ceil 0.5 * ($::MAP->w - $sw) - $sx; 483 my $dx = $self->{dx} = DC::ceil 0.5 * ($::MAP->w - $sw) - $sx;
476 my $dy = $self->{dy} = DC::ceil 0.5 * ($::MAP->h - $sh) - $sy; 484 my $dy = $self->{dy} = DC::ceil 0.5 * ($::MAP->h - $sh) - $sy;
477 485
478 if ($::CFG->{fow_enable}) { 486 if ($::CFG->{fow_enable}) {
487 $sdx_t = $sdy_t = 0;#d#
479 my ($w, $h, $data) = $::MAP->fow_texture ($dx, $dy, $sw, $sh); 488 my ($w, $h, $data) = $::MAP->fow_texture (
489 $dx + (min 0, $sdx_t),
490 $dy + (min 0, $sdy_t),
491 $sw + abs $sdx_t,
492 $sh + abs $sdy_t
493 );
480 494
481 $self->{fow_texture} = new DC::Texture 495 $self->{fow_texture} = new DC::Texture
482 w => $w, 496 w => $w,
483 h => $h, 497 h => $h,
484 data => $data, 498 data => $data,
491 glNewList ($self->{list} ||= glGenList); 505 glNewList ($self->{list} ||= glGenList);
492 506
493 glPushMatrix; 507 glPushMatrix;
494 glTranslate $sx0, $sy0; 508 glTranslate $sx0, $sy0;
495 glScale $::CFG->{map_scale}, $::CFG->{map_scale}; 509 glScale $::CFG->{map_scale}, $::CFG->{map_scale};
496 glTranslate $self->{sdx}, $self->{sdy}; 510 glTranslate DC::ceil $self->{sdx}, DC::ceil $self->{sdy};
497 511
498 warn "mapdraw -$self->{sdx}\n";#d#
499 $::MAP->draw ($dx, $dy, $sw, $sh, 512 $::MAP->draw ($dx, $dy, $sw, $sh,
500 $self->{tilesize}, 513 $self->{tilesize},
501 $::CONN->{player}{tag}, 514 $::CONN->{player}{tag},
502 -$self->{sdx}, -$self->{sdy}); 515 -$self->{sdx}, -$self->{sdy});
503 516
504 glTranslate -$self->{sdx}, -$self->{sdy}; 517 #glTranslate -$self->{sdx}, -$self->{sdy}; # anchor fow at player
505 glScale $self->{tilesize}, $self->{tilesize}; 518 glScale $self->{tilesize}, $self->{tilesize};
506 519
507 if (my $tex = $self->{fow_texture}) { 520 if (my $tex = $self->{fow_texture}) {
508 glPushMatrix; 521 glPushMatrix;
522 glTranslate +(min 0, $sdx_t), (min 0, $sdy_t);
509 glScale 1/3, 1/3; 523 glScale 1/3, 1/3;
510 glEnable GL_TEXTURE_2D; 524 glEnable GL_TEXTURE_2D;
511 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 525 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
512 526
513 glColor +($::CFG->{fow_intensity}) x 3, 0.9; 527 glColor +($::CFG->{fow_intensity}) x 3, 0.9;
592sub refresh_hook { 606sub refresh_hook {
593 my ($self) = @_; 607 my ($self) = @_;
594 608
595 if ($::MAP && $self->{texture_atime} < time) { 609 if ($::MAP && $self->{texture_atime} < time) {
596 my ($w, $h) = @$self{qw(w h)}; 610 my ($w, $h) = @$self{qw(w h)};
611
612 return unless $w && $h;
597 613
598 my $sw = int $::WIDTH / ($::MAPWIDGET->{tilesize} * $::CFG->{map_scale}) + 0.99; 614 my $sw = int $::WIDTH / ($::MAPWIDGET->{tilesize} * $::CFG->{map_scale}) + 0.99;
599 my $sh = int $::HEIGHT / ($::MAPWIDGET->{tilesize} * $::CFG->{map_scale}) + 0.99; 615 my $sh = int $::HEIGHT / ($::MAPWIDGET->{tilesize} * $::CFG->{map_scale}) + 0.99;
600 616
601 my $ox = 0.5 * ($w - $sw); 617 my $ox = 0.5 * ($w - $sw);
830 my $text = $self->{entry}->get_text; 846 my $text = $self->{entry}->get_text;
831 847
832 length $text 848 length $text
833 or return $self->hide; 849 or return $self->hide;
834 850
835 my ($cmd, $arg) = $text =~ /^\s*([^[:space:]]*)(.*)$/;
836
837 if ($text ne $self->{last_search}) { 851 if ($text ne $self->{last_search}) {
838 my @match; 852 my @match;
839 853
840 if ($text =~ /^(.*?)\s+$/) { 854 if ($text =~ /^(.*?)\s+$/) {
855 my ($cmd, $arg) = $text =~ /^\s*([^[:space:]]*)(.*)$/;
841 @match = [$cmd, "(appended whitespace suppresses completion)"]; 856 @match = ([[$cmd,'(appended whitespace suppresses completion)'],$text]);
842 } else { 857 } else {
858 # @match is [command, penalty, command with arguments] until sort
859
860 my ($cmd, $arg) = $text =~ /^\s*([^[:space:]]*)(.*)$/;
861
843 my $regexp = do { 862 my $regexp_abbrev = do {
844 my ($beg, @chr) = split //, lc $cmd; 863 my ($beg, @chr) = split //, lc $cmd;
845 864
846 # the following regex is used to match our "completion entry" 865 # the following regex is used to match our "completion entry"
847 # to an actual command - the parentheses match kind of "overhead" 866 # to an actual command - the parentheses match kind of "overhead"
848 # - the more characters the parentheses match, the less attractive 867 # - the more characters the parentheses match, the less attractive
850 my $regexp = "^\Q$beg\E" 869 my $regexp = "^\Q$beg\E"
851 . join "", map "(?:.*?[ \\\\]\Q$_\E|(.*?)\Q$_\E)", @chr; 870 . join "", map "(?:.*?[ \\\\]\Q$_\E|(.*?)\Q$_\E)", @chr;
852 qr<$regexp> 871 qr<$regexp>
853 }; 872 };
854 873
855 my @penalty; 874 my $regexp_partial = do {
875 my $regexp = "^\Q$text\E(.*)";
876 qr<$regexp>
877 };
856 878
857 for (keys %{$self->{command}}) { 879 for (keys %{$self->{command}}) {
858 if (@penalty = $_ =~ $regexp) { 880 my @scores;
859 push @match, [$_, length join "", map "::$_", grep defined, @penalty]; 881
882 # 1. Complete command [with args]
883 # command is a prefix of the text
884 # score is length of complete command matched
885 # e.g. "invoke summon pet monster bat"
886 # "invoke" "summon pet monster bat" = 6
887 # "invoke summon pet monster" "bat" = 25
888 if ($text =~ /^\Q$_\E(.*)/) {
889 push @scores, [$_, length $_, $text];
860 } 890 }
891
892 # 2. Partial command
893 # text is a prefix of the full command
894 # score is the length of the input text
895 # e.g. "invoke s"
896 # "invoke small fireball" = 8
897 # "invoke summon pet monster" = 8
898
899 if ($_ =~ $regexp_partial) {
900 push @scores, [$_, length $text, $_];
901 }
902
903 # 3. Abbreviation match
904 # attempts to use first word of text as an abbreviated command
905 # score is length of word + 1 - 3 per non-word-initial character
906
907 if (my @penalty = $_ =~ $regexp_abbrev) {
908 push @scores, [$_, (length $cmd) + 1 - (length join "", map "::$_", grep defined, @penalty), "$_$arg"];
909 }
910
911 # Pick the best option for this command
912 push @match, (sort {
913 $b->[1] <=> $a->[1]
914 } @scores)[0];
861 } 915 }
862 916
917 # @match is now [command object, command with arguments]
863 @match = map $self->{command}{$_->[0]}, 918 @match = map [$self->{command}{$_->[0]}, $_->[2]],
864 sort { 919 sort {
865 $a->[1] <=> $b->[1] 920 $b->[1] <=> $a->[1]
866 or $self->{command}{$a->[0]}[4] <=> $self->{command}{$b->[0]}[4] 921 or $self->{command}{$a->[0]}[4] <=> $self->{command}{$b->[0]}[4]
867 or (length $b->[0]) <=> (length $a->[0]) 922 or (length $b->[0]) <=> (length $a->[0])
868 } @match; 923 } @match;
869 } 924 }
870 925
889 $label->{fg} = [1, 1, 1, 1]; 944 $label->{fg} = [1, 1, 1, 1];
890 $label->{bg} = [0, 0, 0, 0]; 945 $label->{bg} = [0, 0, 0, 0];
891 } 946 }
892 947
893 if (@matches) { 948 if (@matches) {
894 $self->{select} = "$matches[0][0]$arg"; 949 $self->{select} = "$matches[0][1]";
895 950
896 $labels[0]->{fg} = [0, 0, 0, 1]; 951 $labels[0]->{fg} = [0, 0, 0, 1];
897 $labels[0]->{bg} = [1, 1, 1, 0.8]; 952 $labels[0]->{bg} = [1, 1, 1, 0.8];
898 } else { 953 } else {
899 $self->{select} = "$cmd$arg"; 954 $self->{select} = "$text";
900 } 955 }
901 956
902 for my $match (@matches) { 957 for my $match (@matches) {
903 my $label = shift @labels; 958 my $label = shift @labels;
904 959
905 if (@labels) { 960 if (@labels) {
906 $label->set_text ("$match->[0]$arg"); 961 $label->set_text ("$match->[1]");
907 $label->set_tooltip ($match->[1]); 962 $label->set_tooltip ("$match->[0][1]");
908 } else { 963 } else {
909 $label->set_text ("..."); 964 $label->set_text ("...");
910 $label->set_tooltip ("Use Cursor-Down to view more matches"); 965 $label->set_tooltip ("Use Cursor-Down to view more matches");
911 last; 966 last;
912 } 967 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines