@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Break long words in differential two-up view

Summary: This should prevent long lines from making the code width different between files, which can be annoying. (And of course, it stops long lines from making a giant scrollbar too.)

Test Plan:
Loaded this diff in Chrome, Firefox, IE9, and IE8:

{F137505}

(That's a screenshot from Chrome, but it looks about the same in the other browsers.)

Reviewers: chad, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin, chad

Maniphest Tasks: T2004

Differential Revision: https://secure.phabricator.com/D8686

authored by

Ben Alpert and committed by
epriestley
9fedd343 85394a9e

+74 -56
+11 -11
resources/celerity/map.php
··· 8 8 'names' => 9 9 array( 10 10 'core.pkg.css' => 'fb144113', 11 - 'core.pkg.js' => 'e39d336b', 11 + 'core.pkg.js' => '57d0e1c4', 12 12 'darkconsole.pkg.js' => 'ca8671ce', 13 - 'differential.pkg.css' => 'cc216438', 13 + 'differential.pkg.css' => '331c38d9', 14 14 'differential.pkg.js' => '11a5b750', 15 15 'diffusion.pkg.css' => '3783278d', 16 16 'diffusion.pkg.js' => '5b4010f4', ··· 55 55 'rsrc/css/application/countdown/timer.css' => '86b7b0a0', 56 56 'rsrc/css/application/diff/inline-comment-summary.css' => '14a91639', 57 57 'rsrc/css/application/differential/add-comment.css' => 'c478bcaa', 58 - 'rsrc/css/application/differential/changeset-view.css' => 'd1951f43', 58 + 'rsrc/css/application/differential/changeset-view.css' => 'df93fa84', 59 59 'rsrc/css/application/differential/core.css' => '7ac3cabc', 60 60 'rsrc/css/application/differential/results-table.css' => '239924f9', 61 61 'rsrc/css/application/differential/revision-comment.css' => '48186045', ··· 463 463 'rsrc/js/core/behavior-line-linker.js' => 'bc778103', 464 464 'rsrc/js/core/behavior-more.js' => '9b9197be', 465 465 'rsrc/js/core/behavior-object-selector.js' => 'b4eef37b', 466 - 'rsrc/js/core/behavior-oncopy.js' => 'c3e218fe', 466 + 'rsrc/js/core/behavior-oncopy.js' => 'e69e4400', 467 467 'rsrc/js/core/behavior-phabricator-nav.js' => 'b5842a5e', 468 468 'rsrc/js/core/behavior-phabricator-remarkup-assist.js' => 'c021950a', 469 469 'rsrc/js/core/behavior-refresh-csrf.js' => 'c4b31646', ··· 505 505 'conpherence-notification-css' => '403cf598', 506 506 'conpherence-update-css' => '1099a660', 507 507 'conpherence-widget-pane-css' => '87b12e0c', 508 - 'differential-changeset-view-css' => 'd1951f43', 508 + 'differential-changeset-view-css' => 'df93fa84', 509 509 'differential-core-view-css' => '7ac3cabc', 510 510 'differential-inline-comment-editor' => 'f2441746', 511 511 'differential-results-table-css' => '239924f9', ··· 596 596 'javelin-behavior-phabricator-nav' => 'b5842a5e', 597 597 'javelin-behavior-phabricator-notification-example' => 'c51a6616', 598 598 'javelin-behavior-phabricator-object-selector' => 'b4eef37b', 599 - 'javelin-behavior-phabricator-oncopy' => 'c3e218fe', 599 + 'javelin-behavior-phabricator-oncopy' => 'e69e4400', 600 600 'javelin-behavior-phabricator-remarkup-assist' => 'c021950a', 601 601 'javelin-behavior-phabricator-reveal-content' => '8f24abfc', 602 602 'javelin-behavior-phabricator-search-typeahead' => 'f6b56f7a', ··· 1634 1634 2 => 'javelin-util', 1635 1635 3 => 'javelin-magical-init', 1636 1636 ), 1637 - 'c3e218fe' => 1638 - array( 1639 - 0 => 'javelin-behavior', 1640 - 1 => 'javelin-dom', 1641 - ), 1642 1637 'c4b31646' => 1643 1638 array( 1644 1639 0 => 'javelin-request', ··· 1813 1808 1 => 'javelin-dom', 1814 1809 2 => 'javelin-view-visitor', 1815 1810 3 => 'javelin-util', 1811 + ), 1812 + 'e69e4400' => 1813 + array( 1814 + 0 => 'javelin-behavior', 1815 + 1 => 'javelin-dom', 1816 1816 ), 1817 1817 'e7c21fb3' => 1818 1818 array(
+38 -21
src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
··· 7 7 return false; 8 8 } 9 9 10 + private function renderColgroup() { 11 + return phutil_tag('colgroup', array(), array( 12 + phutil_tag('col', array('class' => 'num')), 13 + phutil_tag('col', array('class' => 'left')), 14 + phutil_tag('col', array('class' => 'num')), 15 + phutil_tag('col', array('class' => 'copy')), 16 + phutil_tag('col', array('class' => 'right')), 17 + phutil_tag('col', array('class' => 'cov')), 18 + )); 19 + } 20 + 10 21 public function renderTextChange( 11 22 $range_start, 12 23 $range_len, ··· 31 42 } 32 43 33 44 $html = array(); 45 + $html[] = $this->renderColgroup(); 46 + 34 47 $old_lines = $this->getOldLines(); 35 48 $new_lines = $this->getNewLines(); 36 49 $gaps = $this->getGaps(); ··· 184 197 } 185 198 186 199 $o_num = null; 187 - $o_classes = 'left'; 200 + $o_classes = ''; 188 201 $o_text = null; 189 202 if (isset($old_lines[$ii])) { 190 203 $o_num = $old_lines[$ii]['line']; ··· 192 205 if ($old_lines[$ii]['type']) { 193 206 if ($old_lines[$ii]['type'] == '\\') { 194 207 $o_text = $old_lines[$ii]['text']; 195 - $o_classes .= ' comment'; 208 + $o_class = 'comment'; 196 209 } else if ($original_left && !isset($highlight_old[$o_num])) { 197 - $o_classes .= ' old-rebase'; 210 + $o_class = 'old-rebase'; 198 211 } else if (empty($new_lines[$ii])) { 199 - $o_classes .= ' old old-full'; 212 + $o_class = 'old old-full'; 200 213 } else { 201 - $o_classes .= ' old'; 214 + $o_class = 'old'; 202 215 } 216 + $o_classes = $o_class; 203 217 } 204 218 } 205 219 ··· 265 279 } 266 280 } 267 281 } 268 - $n_classes .= ' right'.$n_colspan; 269 282 270 283 if (isset($hunk_starts[$o_num])) { 271 284 $html[] = $context_not_available; ··· 283 296 $n_id = null; 284 297 } 285 298 286 - // NOTE: This is a unicode zero-width space, which we use as a hint 287 - // when intercepting 'copy' events to make sure sensible text ends 288 - // up on the clipboard. See the 'phabricator-oncopy' behavior. 289 - $zero_space = "\xE2\x80\x8B"; 299 + // NOTE: This is a unicode 'word joiner' (essentially a non-breaking 300 + // zero-width space), which we use as a hint when intercepting 'copy' 301 + // events to make sure sensible text ends up on the clipboard. 302 + // See the 'phabricator-oncopy' behavior. 303 + $zero_space = "\xE2\x81\xA0"; 290 304 291 305 // NOTE: The Javascript is sensitive to whitespace changes in this 292 306 // block! ··· 326 340 } 327 341 $html[] = phutil_tag('tr', array('class' => 'inline'), array( 328 342 phutil_tag('th', array()), 329 - phutil_tag('td', array('class' => 'left'), $comment_html), 343 + phutil_tag('td', array(), $comment_html), 330 344 phutil_tag('th', array()), 331 - phutil_tag('td', array('colspan' => 3, 'class' => 'right3'), $new), 345 + phutil_tag('td', array('colspan' => 3), $new), 332 346 )); 333 347 } 334 348 } ··· 338 352 $on_right = true); 339 353 $html[] = phutil_tag('tr', array('class' => 'inline'), array( 340 354 phutil_tag('th', array()), 341 - phutil_tag('td', array('class' => 'left')), 355 + phutil_tag('td', array()), 342 356 phutil_tag('th', array()), 343 357 phutil_tag( 344 358 'td', 345 - array('colspan' => 3, 'class' => 'right3'), 359 + array('colspan' => 3), 346 360 $comment_html), 347 361 )); 348 362 } ··· 391 405 $comment_html = $this->renderInlineComment($comment, $on_right = false); 392 406 $html_old[] = phutil_tag('tr', array('class' => 'inline'), array( 393 407 phutil_tag('th', array()), 394 - phutil_tag('td', array('class' => 'left'), $comment_html), 408 + phutil_tag('td', array(), $comment_html), 395 409 phutil_tag('th', array()), 396 - phutil_tag('td', array('colspan' => 3, 'class' => 'right3')), 410 + phutil_tag('td', array('colspan' => 3)), 397 411 )); 398 412 } 399 413 } ··· 402 416 $comment_html = $this->renderInlineComment($comment, $on_right = true); 403 417 $html_new[] = phutil_tag('tr', array('class' => 'inline'), array( 404 418 phutil_tag('th', array()), 405 - phutil_tag('td', array('class' => 'left')), 419 + phutil_tag('td', array()), 406 420 phutil_tag('th', array()), 407 421 phutil_tag( 408 422 'td', 409 - array('colspan' => 3, 'class' => 'right3'), 423 + array('colspan' => 3), 410 424 $comment_html), 411 425 )); 412 426 } ··· 424 438 $th_new = phutil_tag('th', array('id' => "C{$id}OL1"), 1); 425 439 } 426 440 427 - $output = hsprintf( 441 + $output = array(); 442 + $output[] = $this->renderColgroup(); 443 + 444 + $output[] = hsprintf( 428 445 '<tr class="differential-image-diff">'. 429 446 '%s'. 430 - '<td class="left differential-old-image">%s</td>'. 447 + '<td class="differential-old-image">%s</td>'. 431 448 '%s'. 432 - '<td class="right3 differential-new-image" colspan="3">%s</td>'. 449 + '<td class="differential-new-image" colspan="3">%s</td>'. 433 450 '</tr>'. 434 451 '%s'. 435 452 '%s',
+1 -1
src/applications/diffusion/controller/DiffusionBrowseFileController.php
··· 789 789 $anchor_text, 790 790 791 791 // NOTE: See phabricator-oncopy behavior. 792 - "\xE2\x80\x8B", 792 + "\xE2\x81\xA0", 793 793 794 794 // TODO: [HTML] Not ideal. 795 795 phutil_safe_html(str_replace("\t", ' ', $line['data'])),
+2 -1
src/view/layout/PhabricatorSourceCodeView.php
··· 61 61 pht('...')); 62 62 } else { 63 63 $content_number = $line_number; 64 - $content_line = hsprintf("\xE2\x80\x8B%s", $line); 64 + // NOTE: See phabricator-oncopy behavior. 65 + $content_line = hsprintf("\xE2\x81\xA0%s", $line); 65 66 } 66 67 67 68 $row_attributes = array();
+21 -21
webroot/rsrc/css/application/differential/changeset-view.css
··· 16 16 .differential-diff { 17 17 background: #fff; 18 18 width: 100%; 19 + min-width: 780px; 19 20 border-top: 1px solid {$lightblueborder}; 20 21 border-bottom: 1px solid {$lightblueborder}; 22 + table-layout: fixed; 23 + } 24 + 25 + .differential-diff col.num { 26 + width: 45px; 27 + } 28 + 29 + .differential-diff col.left, 30 + .differential-diff col.right { 31 + width: 49.25%; 32 + } 33 + 34 + .differential-diff col.copy { 35 + width: 0.5%; 36 + } 37 + 38 + .differential-diff col.cov { 39 + width: 1%; 21 40 } 22 41 23 42 .differential-diff td { 24 - min-width: 320px; 25 43 /* 26 44 Disable ligatures in Firefox. Firefox 3 has fancypants ligature support, but 27 45 it gets applied to monospaced fonts, which sucks because it means that the ··· 35 53 letter-spacing: 0.0083334px; 36 54 vertical-align: top; 37 55 white-space: pre-wrap; 56 + word-wrap: break-word; 38 57 padding: 0 8px 1px; 39 58 line-height: 16px; 40 59 } ··· 42 61 .differential-diff th { 43 62 text-align: right; 44 63 padding: 2px 6px 0px 0px; 45 - width: 4%; 46 - min-width: 45px; 47 - max-width: 4%; 48 64 vertical-align: top; 49 65 background: {$lightbluebackground}; 50 66 color: {$bluetext}; ··· 58 74 -webkit-user-select: none; 59 75 -ms-user-select: none; 60 76 user-select: none; 61 - } 62 - .differential-diff td.left { 63 - width: 45%; 64 - } 65 - 66 - .differential-diff td.right, 67 - .differential-diff td.right1 { 68 - width: 43.5%; 69 - } 70 - 71 - .differential-diff td.right2 { 72 - width: 44.5%; 73 - } 74 - .differential-diff td.right3 { 75 - width: 45%; 76 77 } 77 78 78 79 .differential-changeset-immutable .differential-diff th { ··· 126 127 } 127 128 128 129 .differential-diff td.cov { 129 - min-width: 1%; 130 - width: 1%; 131 130 padding: 0; 132 131 } 133 132 ··· 252 251 width: 100%; 253 252 -moz-box-sizing: border-box; 254 253 -webkit-box-sizing: border-box; 254 + box-sizing: border-box; 255 255 overflow: hidden; 256 256 white-space: normal; 257 257 }
+1 -1
webroot/rsrc/js/core/behavior-oncopy.js
··· 16 16 */ 17 17 JX.behavior('phabricator-oncopy', function() { 18 18 19 - var zws = "\u200B"; // Unicode Zero-Width Space 19 + var zws = "\u2060"; // Unicode Word Joiner (Non-Breaking Zero-Width Space) 20 20 21 21 JX.enableDispatch(document.body, 'copy'); 22 22 JX.Stratcom.listen(