$ctx->{parent_msg} = $parent;
}
+sub dfqry_text ($) {
+ my ($ctx) = @_;
+ my $qry_dfblob = delete $ctx->{-qry_dfblob} or return (undef);
+ my $q = join ' ', map {
+ chop if length > 7; # include 1 abbrev "older" patches
+ "dfblob:$_";
+ } @$qry_dfblob;
+ local $Text::Wrap::columns = COLS;
+ local $Text::Wrap::huge = 'overflow';
+ $q = wrap('', '', $q);
+ my $rows = ($q =~ tr/\n/\n/) + 1;
+ ($rows, ascii_html($q));
+}
+
# writes to zbuf
sub html_footer {
my ($ctx, $hdr) = @_;
my $upfx = '../';
my (@related, @skel);
my $foot = '<pre>';
- my $qry_dfblob = delete $ctx->{-qry_dfblob};
- if ($qry_dfblob && $ctx->{ibx}->isrch) {
- my $q = ''; # search for either ancestor or descendent patches
- for (@$qry_dfblob) {
- chop if length > 7; # include 1 abbrev "older" patches
- $q .= "dfblob:$_ ";
- }
- chop $q; # omit trailing SP
- local $Text::Wrap::columns = COLS;
- local $Text::Wrap::huge = 'overflow';
- $q = wrap('', '', $q);
- my $rows = ($q =~ tr/\n/\n/) + 1;
- $q = ascii_html($q);
+ my ($rows, $q) = dfqry_text $ctx;
+ if ($rows && $ctx->{ibx}->isrch) {
$related[0] = <<EOM;
<form id=related
action=$upfx
# TODO: should there be another textarea which attempts to
# search for the exact email which was applied to make this
# commit?
- if (my $qry_dfblob = delete $ctx->{-qry_dfblob}) {
- my $q = '';
- for (@$qry_dfblob) {
- # keep blobs as short as reasonable, emails
- # are going to be older than what's in git
- substr($_, 7, 64, '');
- $q .= "dfblob:$_ ";
- }
- chop $q; # no trailing SP
- local $Text::Wrap::columns = PublicInbox::View::COLS;
- local $Text::Wrap::huge = 'overflow';
- $q = wrap('', '', $q);
- my $rows = ($q =~ tr/\n/\n/) + 1;
- $q = ascii_html($q);
+ my ($rows, $q) = PublicInbox::View::dfqry_text $ctx;
+ if ($rows) {
my $ibx_url = ibx_url_for($ctx);
my $alt;
if (defined $ibx_url) {