lib/PublicInbox/SearchView.pm | 18 ++++++++++++++---- lib/PublicInbox/View.pm | 57 ++++++++++++++++++++++++++++++++--------------------- diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index ab3dddb48252ea62197fd79d8fbb2d746175825b..5d4f4fe249c38157318d8fc50b0cbc132ad567ac 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -138,7 +138,7 @@ sub tdump { my ($cb, $res, $mset, $q, $ctx) = @_; my $fh = $cb->([200, ['Content-Type'=>'text/html; charset=UTF-8']]); - $fh->write($res); + $fh->write($res .= ''); my %pct; my @m = map { my $i = $_; @@ -168,9 +168,15 @@ $th->order(*PublicInbox::View::rsort_ts); } my $git = $ctx->{git} ||= PublicInbox::Git->new($ctx->{git_dir}); - my $state = { ctx => $ctx, anchor_idx => 0, pct => \%pct }; + my $state = { + ctx => $ctx, + anchor_idx => 0, + pct => \%pct, + cur_level => 0 + }; $ctx->{searchview} = 1; tdump_ent($fh, $git, $state, $_, 0) for $th->rootset; + PublicInbox::View::thread_adj_level($fh, $state, 0); Email::Address->purge_cache; $fh->write(search_nav_bot($mset, $q). "\n\n" . @@ -193,10 +199,13 @@ Email::MIME->new($git->cat_file('HEAD:'.$path)); }; } if ($mime) { + my $end = + PublicInbox::View::thread_adj_level($fh, $state, $level); PublicInbox::View::index_entry($fh, $mime, $level, $state); + $fh->write($end) if $end; } else { my $mid = $node->messageid; - $fh->write(PublicInbox::View::ghost_table('', $mid, $level)); + PublicInbox::View::ghost_flush($fh, $state, '', $mid, $level); } tdump_ent($fh, $git, $state, $node->child, $level + 1); tdump_ent($fh, $git, $state, $node->next, $level); @@ -214,7 +223,8 @@ my $query = PublicInbox::Hval->new_oneline($q->{q}); my $qh = $query->as_html; my $A = $q->qs_html(x => 'A', r => undef); - my $res = "