Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15391798
D15853.id38191.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D15853.id38191.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 11:41 AM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7706954
Default Alt Text
D15853.id38191.diff (2 KB)
Attached To
Mode
D15853: Pick context windows for inlines in a slightly smarter way
Attached
Detach File
Event Timeline
Log In to Comment