Page MenuHomePhabricator

D15853.diff
No OneTemporary

D15853.diff

diff --git a/src/applications/differential/mail/DifferentialInlineCommentMailView.php b/src/applications/differential/mail/DifferentialInlineCommentMailView.php
--- a/src/applications/differential/mail/DifferentialInlineCommentMailView.php
+++ b/src/applications/differential/mail/DifferentialInlineCommentMailView.php
@@ -290,9 +290,27 @@
$start = $comment->getLineNumber();
$length = $comment->getLineLength();
+ // By default, show one line of context around the target inline.
+ $context = 1;
+
+ // If the inline is at least 3 lines long, don't show any extra context.
+ if ($length >= 2) {
+ $context = 0;
+ }
+
+ // If the inline is more than 7 lines long, only show the first 7 lines.
+ if ($length >= 6) {
+ $length = 6;
+ }
+
if (!$is_html) {
$hunks = $changeset->getHunks();
- $patch = $parser->makeContextDiff($hunks, $is_new, $start, $length, 1);
+ $patch = $parser->makeContextDiff(
+ $hunks,
+ $is_new,
+ $start,
+ $length,
+ $context);
$patch = phutil_split_lines($patch);
// Remove the "@@ -x,y +u,v @@" line.
@@ -318,7 +336,10 @@
$parser->setRenderer(new DifferentialChangesetOneUpMailRenderer());
- return $parser->render($start - 1, $length + 3, array());
+ return $parser->render(
+ $start - $context,
+ $length + 1 + (2 * $context),
+ array());
}
private function renderPatch(
diff --git a/src/applications/differential/parser/DifferentialChangesetParser.php b/src/applications/differential/parser/DifferentialChangesetParser.php
--- a/src/applications/differential/parser/DifferentialChangesetParser.php
+++ b/src/applications/differential/parser/DifferentialChangesetParser.php
@@ -852,7 +852,7 @@
$range_end = $this->getOffset($offset_map, $range_start + $range_len);
$range_start = $this->getOffset($offset_map, $range_start);
- $range_len = $range_end - $range_start;
+ $range_len = ($range_end - $range_start);
}
$render_pch = $this->shouldRenderPropertyChangeHeader($this->changeset);
diff --git a/src/applications/differential/render/DifferentialChangesetOneUpMailRenderer.php b/src/applications/differential/render/DifferentialChangesetOneUpMailRenderer.php
--- a/src/applications/differential/render/DifferentialChangesetOneUpMailRenderer.php
+++ b/src/applications/differential/render/DifferentialChangesetOneUpMailRenderer.php
@@ -73,6 +73,8 @@
}
}
+ $style = "padding: 0 2px; {$style}";
+
$out[] = phutil_tag(
'div',
array(

File Metadata

Mime Type
text/plain
Expires
Sun, May 12, 2:50 AM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6287439
Default Alt Text
D15853.diff (2 KB)

Event Timeline