]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
go.pl: fix short circuiting during channel search
authorDylan Lloyd <redacted>
Tue, 26 Feb 2019 07:24:00 +0000 (12:54 +0530)
committerDylan Lloyd <redacted>
Tue, 26 Feb 2019 07:24:00 +0000 (12:54 +0530)
Change-Id: Idfdde63a370cf09f485229e6f7f7c24860a1a320

scripts/go.pl

index 0b0a2a24ef56c9c2eee9307415c129fcdcb962d6..5907a0628ad721a809ee13655c8a6c3f637ba554 100644 (file)
@@ -29,7 +29,7 @@ use Irssi::Irc;
 #     completion. The leading '#' of channel names is optional either way.
 #
 
-$VERSION = '1.1';
+$VERSION = '1.1.1';
 
 %IRSSI = (
     authors     => 'nohar',
@@ -37,7 +37,7 @@ $VERSION = '1.1';
     name        => 'go to window',
     description => 'Implements /go command that activates a window given a name/partial name. It features a nice completion.',
     license     => 'GPLv2 or later',
-    changed     => '2017-02-02'
+    changed     => '2019-02-25'
 );
 
 sub _make_regexp {
@@ -81,13 +81,19 @@ sub cmd_go
                Irssi::settings_get_bool('go_match_case_sensitive'),
                Irssi::settings_get_bool('go_match_anchored'));
 
+       my @matches = [];
        foreach my $w (Irssi::windows) {
                my $name = $w->get_active_name();
-               if ($name =~ $re) {
+               if ($name =~ /$re$/) {
                        $w->set_active();
                        return;
+               } elsif ($name =~ /$re/) {
+                       push(@matches, $w);
                }
        }
+       if (@matches) {
+               $matches[0]->set_active()
+       }
 }
 
 Irssi::command_bind("go", "cmd_go");
@@ -103,3 +109,5 @@ Irssi::settings_add_bool('go', 'go_complete_anchored', 0);
 #   - made case-sensitivity of match configurable
 #   - made anchoring of search strings configurable
 #
+# 2019-02-025  1.1.1  dylan lloyd <dylan@disinclined.org>
+#   - fixed short-circuiting during channel search
git clone https://git.99rst.org/PROJECT