@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.

Use subtler highlighting for copied and moved code

Summary:
The highlighting is distracting according to Nick Shrock and others.
Real designer, Lee Byron, helped me with this.

It also gives us unagressive target for jumping to the source line in future.

Another feature I will probably implement is highlighting also the source of copies/moves.
I will use the right side of the left column for it.

Test Plan:
Hover copied notifier.
Hover coverage notifier.

I've also checked that this doesn't break our super-flaky old/new code JavaScript detector.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin, leebyron, schrockn

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

vrana cd63d9b2 1c5412eb

+86 -55
+37 -37
src/__celerity_resource_map__.php
··· 538 538 ), 539 539 'differential-changeset-view-css' => 540 540 array( 541 - 'uri' => '/res/4ce438cd/rsrc/css/application/differential/changeset-view.css', 541 + 'uri' => '/res/8e2ace51/rsrc/css/application/differential/changeset-view.css', 542 542 'type' => 'css', 543 543 'requires' => 544 544 array( ··· 969 969 ), 970 970 'javelin-behavior-differential-populate' => 971 971 array( 972 - 'uri' => '/res/c0979571/rsrc/js/application/differential/behavior-populate.js', 972 + 'uri' => '/res/a955bf2c/rsrc/js/application/differential/behavior-populate.js', 973 973 'type' => 'js', 974 974 'requires' => 975 975 array( ··· 2510 2510 'uri' => '/res/pkg/0c96375e/core.pkg.js', 2511 2511 'type' => 'js', 2512 2512 ), 2513 - '2debe0e0' => 2513 + 'd9299c35' => 2514 2514 array( 2515 2515 'name' => 'differential.pkg.css', 2516 2516 'symbols' => ··· 2529 2529 11 => 'differential-local-commits-view-css', 2530 2530 12 => 'inline-comment-summary-css', 2531 2531 ), 2532 - 'uri' => '/res/pkg/2debe0e0/differential.pkg.css', 2532 + 'uri' => '/res/pkg/d9299c35/differential.pkg.css', 2533 2533 'type' => 'css', 2534 2534 ), 2535 - '5b7b36d7' => 2535 + 'dc7ca445' => 2536 2536 array( 2537 2537 'name' => 'differential.pkg.js', 2538 2538 'symbols' => ··· 2556 2556 16 => 'javelin-behavior-differential-dropdown-menus', 2557 2557 17 => 'javelin-behavior-buoyant', 2558 2558 ), 2559 - 'uri' => '/res/pkg/5b7b36d7/differential.pkg.js', 2559 + 'uri' => '/res/pkg/dc7ca445/differential.pkg.js', 2560 2560 'type' => 'js', 2561 2561 ), 2562 2562 'c8ce2d88' => ··· 2652 2652 'aphront-dialog-view-css' => '2b054c5c', 2653 2653 'aphront-error-view-css' => '2b054c5c', 2654 2654 'aphront-form-view-css' => '2b054c5c', 2655 - 'aphront-headsup-action-list-view-css' => '2debe0e0', 2655 + 'aphront-headsup-action-list-view-css' => 'd9299c35', 2656 2656 'aphront-headsup-view-css' => '2b054c5c', 2657 2657 'aphront-list-filter-view-css' => '2b054c5c', 2658 2658 'aphront-pager-view-css' => '2b054c5c', ··· 2662 2662 'aphront-tokenizer-control-css' => '2b054c5c', 2663 2663 'aphront-tooltip-css' => '2b054c5c', 2664 2664 'aphront-typeahead-control-css' => '2b054c5c', 2665 - 'differential-changeset-view-css' => '2debe0e0', 2666 - 'differential-core-view-css' => '2debe0e0', 2667 - 'differential-inline-comment-editor' => '5b7b36d7', 2668 - 'differential-local-commits-view-css' => '2debe0e0', 2669 - 'differential-results-table-css' => '2debe0e0', 2670 - 'differential-revision-add-comment-css' => '2debe0e0', 2671 - 'differential-revision-comment-css' => '2debe0e0', 2672 - 'differential-revision-comment-list-css' => '2debe0e0', 2673 - 'differential-revision-history-css' => '2debe0e0', 2674 - 'differential-table-of-contents-css' => '2debe0e0', 2665 + 'differential-changeset-view-css' => 'd9299c35', 2666 + 'differential-core-view-css' => 'd9299c35', 2667 + 'differential-inline-comment-editor' => 'dc7ca445', 2668 + 'differential-local-commits-view-css' => 'd9299c35', 2669 + 'differential-results-table-css' => 'd9299c35', 2670 + 'differential-revision-add-comment-css' => 'd9299c35', 2671 + 'differential-revision-comment-css' => 'd9299c35', 2672 + 'differential-revision-comment-list-css' => 'd9299c35', 2673 + 'differential-revision-history-css' => 'd9299c35', 2674 + 'differential-table-of-contents-css' => 'd9299c35', 2675 2675 'diffusion-commit-view-css' => 'c8ce2d88', 2676 2676 'diffusion-icons-css' => 'c8ce2d88', 2677 - 'inline-comment-summary-css' => '2debe0e0', 2677 + 'inline-comment-summary-css' => 'd9299c35', 2678 2678 'javelin-behavior' => '8a5de8a3', 2679 2679 'javelin-behavior-aphront-basic-tokenizer' => '97f65640', 2680 - 'javelin-behavior-aphront-drag-and-drop' => '5b7b36d7', 2681 - 'javelin-behavior-aphront-drag-and-drop-textarea' => '5b7b36d7', 2680 + 'javelin-behavior-aphront-drag-and-drop' => 'dc7ca445', 2681 + 'javelin-behavior-aphront-drag-and-drop-textarea' => 'dc7ca445', 2682 2682 'javelin-behavior-aphront-form-disable-on-submit' => '0c96375e', 2683 2683 'javelin-behavior-audit-preview' => '5e68be89', 2684 - 'javelin-behavior-buoyant' => '5b7b36d7', 2685 - 'javelin-behavior-differential-accept-with-errors' => '5b7b36d7', 2686 - 'javelin-behavior-differential-add-reviewers-and-ccs' => '5b7b36d7', 2687 - 'javelin-behavior-differential-comment-jump' => '5b7b36d7', 2688 - 'javelin-behavior-differential-diff-radios' => '5b7b36d7', 2689 - 'javelin-behavior-differential-dropdown-menus' => '5b7b36d7', 2690 - 'javelin-behavior-differential-edit-inline-comments' => '5b7b36d7', 2691 - 'javelin-behavior-differential-feedback-preview' => '5b7b36d7', 2692 - 'javelin-behavior-differential-keyboard-navigation' => '5b7b36d7', 2693 - 'javelin-behavior-differential-populate' => '5b7b36d7', 2694 - 'javelin-behavior-differential-show-more' => '5b7b36d7', 2684 + 'javelin-behavior-buoyant' => 'dc7ca445', 2685 + 'javelin-behavior-differential-accept-with-errors' => 'dc7ca445', 2686 + 'javelin-behavior-differential-add-reviewers-and-ccs' => 'dc7ca445', 2687 + 'javelin-behavior-differential-comment-jump' => 'dc7ca445', 2688 + 'javelin-behavior-differential-diff-radios' => 'dc7ca445', 2689 + 'javelin-behavior-differential-dropdown-menus' => 'dc7ca445', 2690 + 'javelin-behavior-differential-edit-inline-comments' => 'dc7ca445', 2691 + 'javelin-behavior-differential-feedback-preview' => 'dc7ca445', 2692 + 'javelin-behavior-differential-keyboard-navigation' => 'dc7ca445', 2693 + 'javelin-behavior-differential-populate' => 'dc7ca445', 2694 + 'javelin-behavior-differential-show-more' => 'dc7ca445', 2695 2695 'javelin-behavior-diffusion-commit-graph' => '5e68be89', 2696 2696 'javelin-behavior-diffusion-pull-lastmodified' => '5e68be89', 2697 2697 'javelin-behavior-maniphest-batch-selector' => '7707de41', ··· 2701 2701 'javelin-behavior-maniphest-transaction-preview' => '7707de41', 2702 2702 'javelin-behavior-phabricator-autofocus' => '0c96375e', 2703 2703 'javelin-behavior-phabricator-keyboard-shortcuts' => '0c96375e', 2704 - 'javelin-behavior-phabricator-object-selector' => '5b7b36d7', 2704 + 'javelin-behavior-phabricator-object-selector' => 'dc7ca445', 2705 2705 'javelin-behavior-phabricator-oncopy' => '0c96375e', 2706 2706 'javelin-behavior-phabricator-tooltips' => '0c96375e', 2707 2707 'javelin-behavior-phabricator-watch-anchor' => '0c96375e', 2708 2708 'javelin-behavior-refresh-csrf' => '0c96375e', 2709 - 'javelin-behavior-repository-crossreference' => '5b7b36d7', 2709 + 'javelin-behavior-repository-crossreference' => 'dc7ca445', 2710 2710 'javelin-behavior-workflow' => '0c96375e', 2711 2711 'javelin-dom' => '8a5de8a3', 2712 2712 'javelin-event' => '8a5de8a3', ··· 2728 2728 'maniphest-task-summary-css' => '7839ae2d', 2729 2729 'maniphest-transaction-detail-css' => '7839ae2d', 2730 2730 'phabricator-app-buttons-css' => '2b054c5c', 2731 - 'phabricator-content-source-view-css' => '2debe0e0', 2731 + 'phabricator-content-source-view-css' => 'd9299c35', 2732 2732 'phabricator-core-buttons-css' => '2b054c5c', 2733 2733 'phabricator-core-css' => '2b054c5c', 2734 2734 'phabricator-directory-css' => '2b054c5c', 2735 - 'phabricator-drag-and-drop-file-upload' => '5b7b36d7', 2735 + 'phabricator-drag-and-drop-file-upload' => 'dc7ca445', 2736 2736 'phabricator-dropdown-menu' => '0c96375e', 2737 2737 'phabricator-flag-css' => '2b054c5c', 2738 2738 'phabricator-jump-nav' => '2b054c5c', 2739 2739 'phabricator-keyboard-shortcut' => '0c96375e', 2740 2740 'phabricator-keyboard-shortcut-manager' => '0c96375e', 2741 2741 'phabricator-menu-item' => '0c96375e', 2742 - 'phabricator-object-selector-css' => '2debe0e0', 2742 + 'phabricator-object-selector-css' => 'd9299c35', 2743 2743 'phabricator-paste-file-upload' => '0c96375e', 2744 2744 'phabricator-prefab' => '0c96375e', 2745 2745 'phabricator-project-tag-css' => '7839ae2d', 2746 2746 'phabricator-remarkup-css' => '2b054c5c', 2747 - 'phabricator-shaped-request' => '5b7b36d7', 2747 + 'phabricator-shaped-request' => 'dc7ca445', 2748 2748 'phabricator-standard-page-view' => '2b054c5c', 2749 2749 'phabricator-tooltip' => '0c96375e', 2750 2750 'phabricator-transaction-view-css' => '2b054c5c',
+22 -8
src/applications/differential/parser/changeset/DifferentialChangesetParser.php
··· 1396 1396 $o_attr = null; 1397 1397 } 1398 1398 1399 + $n_copy = '<td class="copy"></td>'; 1399 1400 1400 1401 if (isset($this->new[$ii])) { 1401 1402 $n_num = $this->new[$ii]['line']; ··· 1417 1418 if ($this->new[$ii]['type']) { 1418 1419 if ($this->new[$ii]['type'] == '\\') { 1419 1420 $n_text = $this->new[$ii]['text']; 1420 - $n_attr = ' class="comment"'; 1421 - } else if (isset($copy_lines[$n_num])) { 1421 + $n_class = 'comment'; 1422 + } else if (empty($this->old[$ii])) { 1423 + $n_class = 'new new-full'; 1424 + } else { 1425 + $n_class = 'new'; 1426 + } 1427 + $n_attr = ' class="'.$n_class.'"'; 1428 + 1429 + if ($this->new[$ii]['type'] == '\\' || !isset($copy_lines[$n_num])) { 1430 + $n_copy = '<td class="copy '.$n_class.'"></td>'; 1431 + } else { 1422 1432 list($orig_file, $orig_line, $orig_type) = $copy_lines[$n_num]; 1423 1433 $title = ($orig_type == '-' ? 'Moved' : 'Copied').' from '; 1424 1434 if ($orig_file == '') { ··· 1430 1440 dirname('/'.$orig_file); 1431 1441 } 1432 1442 $class = ($orig_type == '-' ? 'new-move' : 'new-copy'); 1433 - $n_attr = 1434 - ' class="'.$class.'" title="'.phutil_escape_html($title).'"'; 1435 - } else if (empty($this->old[$ii])) { 1436 - $n_attr = ' class="new new-full"'; 1437 - } else { 1438 - $n_attr = ' class="new"'; 1443 + $n_copy = javelin_render_tag( 1444 + 'td', 1445 + array( 1446 + 'meta' => array( 1447 + 'msg' => $title, 1448 + ), 1449 + 'class' => 'copy '.$class, 1450 + ), 1451 + ''); 1439 1452 } 1440 1453 } 1441 1454 } else { ··· 1470 1483 '<th'.$o_id.'>'.$o_num.'</th>'. 1471 1484 '<td'.$o_attr.'>'.$o_text.'</td>'. 1472 1485 '<th'.$n_id.'>'.$n_num.'</th>'. 1486 + $n_copy. 1473 1487 // NOTE: This is a unicode zero-width space, which we use as a hint 1474 1488 // when intercepting 'copy' events to make sure sensible text ends 1475 1489 // up on the clipboard. See the 'phabricator-oncopy' behavior.
+14 -7
webroot/rsrc/css/application/differential/changeset-view.css
··· 80 80 background: #ffaaaa; 81 81 } 82 82 83 - .differential-diff td.new-copy { 84 - background: #ffffaa; 83 + .differential-diff td.new-full, 84 + .differential-diff td.new span.bright { 85 + background: #aaffaa; 86 + } 87 + 88 + .differential-diff td.copy { 89 + width: 6px; 90 + padding: 0; 85 91 } 86 92 87 - .differential-diff td.new-move { 88 - background: #ffddaa; 93 + .differential-diff td.new-copy, 94 + .differential-diff td.new-copy span.bright { 95 + background: #ffffaa; 89 96 } 90 97 91 - .differential-diff td.new-full, 92 - .differential-diff td.new span.bright { 93 - background: #aaffaa; 98 + .differential-diff td.new-move, 99 + .differential-diff td.new-move span.bright { 100 + background: #eeee44; 94 101 } 95 102 96 103 .differential-diff td.comment {
+13 -3
webroot/rsrc/js/application/differential/behavior-populate.js
··· 65 65 66 66 // NOTE: Using className is not best practice, but the diff UI is perf 67 67 // sensitive. 68 - if (!t.className.match(/cov/)) { 68 + if (!t.className.match(/cov|copy/)) { 69 69 return; 70 70 } 71 71 ··· 78 78 } else { 79 79 highlight_class = null; 80 80 var msg; 81 + var align = 'E'; 82 + var sibling = 'previousSibling'; 81 83 if (t.className.match(/cov-C/)) { 82 84 msg = 'Covered'; 83 85 highlight_class = 'source-cov-C'; ··· 87 89 } else if (t.className.match(/cov-N/)) { 88 90 msg = 'Not Executable'; 89 91 highlight_class = 'source-cov-N'; 92 + } else { 93 + var match = /new-copy|new-move/.exec(t.className); 94 + if (match) { 95 + align = 'N'; // TODO: 'W' 96 + sibling = 'nextSibling'; 97 + msg = JX.Stratcom.getData(t).msg; 98 + highlight_class = match[0]; 99 + } 90 100 } 91 101 92 102 if (msg) { 93 - JX.Tooltip.show(t, 120, 'E', msg); 103 + JX.Tooltip.show(t, 120, align, msg); 94 104 } 95 105 96 106 if (highlight_class) { 97 - highlighted = t.previousSibling; 107 + highlighted = t[sibling]; 98 108 JX.DOM.alterClass(highlighted, highlight_class, true); 99 109 } 100 110 }