about summary refs log tree commit homepage
path: root/lib/PublicInbox/WwwListing.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-09-10 08:17:00 +0000
committerEric Wong <e@80x24.org>2022-09-10 19:50:31 +0000
commitffea51e5468ae4db1e8cafd5fc44cc9990f9fb90 (patch)
tree53bd348d0f08b893d2c9065a57a7d1d2ad9b2c1f /lib/PublicInbox/WwwListing.pm
parent4fef904295e07dc9d0a144a4e6fc5bfb59c80fb9 (diff)
downloadpublic-inbox-ffea51e5468ae4db1e8cafd5fc44cc9990f9fb90.tar.gz
We need to branch for non-empty `q=' parameters anyways, but
`q=' is usually empty/unset.  While we're in the area, `chomp'
reads `$/' while `chop' is simpler.  Furthermore, we can shave
a few bytes off the form HTML by omitting spaces before `/>'
and placing `\n' to wrap long lines before attribute names.
Diffstat (limited to 'lib/PublicInbox/WwwListing.pm')
-rw-r--r--lib/PublicInbox/WwwListing.pm18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm
index 0ab41452..35abf050 100644
--- a/lib/PublicInbox/WwwListing.pm
+++ b/lib/PublicInbox/WwwListing.pm
@@ -169,17 +169,15 @@ sub mset_nav_top {
         my ($ctx, $mset) = @_;
         my $q = $ctx->{-sq};
         my $qh = $q->{'q'} // '';
-        utf8::decode($qh);
-        $qh = ascii_html($qh);
-        $qh = qq[\nvalue="$qh"] if $qh ne '';
-        my $rv = <<EOM;
-<form
-action="./"><pre><input name=q type=text$qh
-/><input type=submit value="locate inbox"
-/><input type=submit name=a value="search all inboxes"
-/></pre></form><pre>
+        if ($qh ne '') {
+                utf8::decode($qh);
+                $qh = qq[\nvalue="].ascii_html($qh).'"';
+        }
+        chop(my $rv = <<EOM);
+<form action="./"><pre><input name=q type=text$qh/><input
+type=submit value="locate inbox"/><input type=submit name=a
+value="search all inboxes"/></pre></form><pre>
 EOM
-        chomp $rv;
         if (defined($q->{'q'})) {
                 my $initial_q = $ctx->{-uxs_retried};
                 if (defined $initial_q) {