From d4b96bcf6b017678cbf5f966ba7a9ab9a458969f Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 17 Feb 2019 04:06:27 -0800 Subject: [PATCH] Remove hidden zero-width spaces affecting copy behavior Summary: Ref T13161. Ref T12822. Today, we use invisible Zero-Width Spaces to try to improve copy/paste behavior from Differential. After D20188, we no longer need ZWS characters to avoid copying line numbers. Get rid of these secret invisible semantic ZWS characters completely. This means that both the left-hand and right-hand side of diffs become copyable, which isn't desired. I'll fix that with a hundred thousand lines of Javascript in the next change: this is a step toward everything working better, but doesn't fix everything yet. Test Plan: - Grepped for `zws`, `grep -i zero | grep -i width`. - Copied text out of Differential: got both sides of the diff (not ideal). Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13161, T12822 Differential Revision: https://secure.phabricator.com/D20189 --- resources/celerity/map.php | 30 +++++++++---------- .../DifferentialChangesetTwoUpRenderer.php | 10 +------ .../differential/changeset-view.css | 5 ---- .../repository/repository-crossreference.js | 5 ---- 4 files changed, 16 insertions(+), 34 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 441f7108d1..6b13a2dace 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -11,8 +11,8 @@ return array( 'conpherence.pkg.js' => '020aebcf', 'core.pkg.css' => '261ee8cf', 'core.pkg.js' => '5ace8a1e', - 'differential.pkg.css' => '801c5653', - 'differential.pkg.js' => '1f211736', + 'differential.pkg.css' => 'fcc82bc0', + 'differential.pkg.js' => '0e2b0e2c', 'diffusion.pkg.css' => '42c75c37', 'diffusion.pkg.js' => '91192d85', 'maniphest.pkg.css' => '35995d6d', @@ -61,7 +61,7 @@ return array( 'rsrc/css/application/dashboard/dashboard.css' => '4267d6c6', 'rsrc/css/application/diff/inline-comment-summary.css' => '81eb368d', 'rsrc/css/application/differential/add-comment.css' => '7e5900d9', - 'rsrc/css/application/differential/changeset-view.css' => '8a997ed9', + 'rsrc/css/application/differential/changeset-view.css' => '58236820', 'rsrc/css/application/differential/core.css' => 'bdb93065', 'rsrc/css/application/differential/phui-inline-comment.css' => '48acce5b', 'rsrc/css/application/differential/revision-comment.css' => '7dbc8d1d', @@ -420,7 +420,7 @@ return array( 'rsrc/js/application/releeph/releeph-preview-branch.js' => '75184d68', 'rsrc/js/application/releeph/releeph-request-state-change.js' => '9f081f05', 'rsrc/js/application/releeph/releeph-request-typeahead.js' => 'aa3a100c', - 'rsrc/js/application/repository/repository-crossreference.js' => 'db0c0214', + 'rsrc/js/application/repository/repository-crossreference.js' => 'c15122b4', 'rsrc/js/application/search/behavior-reorder-profile-menu-items.js' => 'e5bdb730', 'rsrc/js/application/search/behavior-reorder-queries.js' => 'b86f297f', 'rsrc/js/application/transactions/behavior-comment-actions.js' => '4dffaeb2', @@ -541,7 +541,7 @@ return array( 'conpherence-thread-manager' => 'aec8e38c', 'conpherence-transaction-css' => '3a3f5e7e', 'd3' => 'd67475f5', - 'differential-changeset-view-css' => '8a997ed9', + 'differential-changeset-view-css' => '58236820', 'differential-core-view-css' => 'bdb93065', 'differential-revision-add-comment-css' => '7e5900d9', 'differential-revision-comment-css' => '7dbc8d1d', @@ -671,7 +671,7 @@ return array( 'javelin-behavior-reorder-applications' => 'aa371860', 'javelin-behavior-reorder-columns' => '8ac32fd9', 'javelin-behavior-reorder-profile-menu-items' => 'e5bdb730', - 'javelin-behavior-repository-crossreference' => 'db0c0214', + 'javelin-behavior-repository-crossreference' => 'c15122b4', 'javelin-behavior-scrollbar' => '92388bae', 'javelin-behavior-search-reorder-queries' => 'b86f297f', 'javelin-behavior-select-content' => 'e8240b50', @@ -1380,6 +1380,9 @@ return array( 'javelin-vector', 'javelin-typeahead-static-source', ), + 58236820 => array( + 'phui-inline-comment-view-css', + ), '5902260c' => array( 'javelin-util', 'javelin-magical-init', @@ -1587,9 +1590,6 @@ return array( '8a16f91b' => array( 'syntax-default-css', ), - '8a997ed9' => array( - 'phui-inline-comment-view-css', - ), '8ac32fd9' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1912,6 +1912,12 @@ return array( 'c03f2fb4' => array( 'javelin-install', ), + 'c15122b4' => array( + 'javelin-behavior', + 'javelin-dom', + 'javelin-stratcom', + 'javelin-uri', + ), 'c2c500a7' => array( 'javelin-install', 'javelin-dom', @@ -2008,12 +2014,6 @@ return array( 'javelin-uri', 'phabricator-notification', ), - 'db0c0214' => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-stratcom', - 'javelin-uri', - ), 'dfa1d313' => array( 'javelin-behavior', 'javelin-dom', diff --git a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php index baf08aac77..d975d82522 100644 --- a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php @@ -301,11 +301,6 @@ final class DifferentialChangesetTwoUpRenderer } } - // NOTE: This is a unicode zero-width space, which we use as a hint when - // intercepting 'copy' events to make sure sensible text ends up on the - // clipboard. See the 'phabricator-oncopy' behavior. - $zero_space = "\xE2\x80\x8B"; - $old_number = phutil_tag( 'td', array( @@ -330,10 +325,7 @@ final class DifferentialChangesetTwoUpRenderer phutil_tag( 'td', array('class' => $n_classes, 'colspan' => $n_colspan), - array( - phutil_tag('span', array('class' => 'zwsp'), $zero_space), - $n_text, - )), + $n_text), $n_cov, )); diff --git a/webroot/rsrc/css/application/differential/changeset-view.css b/webroot/rsrc/css/application/differential/changeset-view.css index a49dd4905b..59faa8399e 100644 --- a/webroot/rsrc/css/application/differential/changeset-view.css +++ b/webroot/rsrc/css/application/differential/changeset-view.css @@ -67,11 +67,6 @@ padding: 1px 4px; } -.differential-diff td .zwsp { - position: absolute; - width: 0; -} - .prose-diff { padding: 12px 0; white-space: pre-wrap; diff --git a/webroot/rsrc/js/application/repository/repository-crossreference.js b/webroot/rsrc/js/application/repository/repository-crossreference.js index 548ef6173b..d6ff2a06aa 100644 --- a/webroot/rsrc/js/application/repository/repository-crossreference.js +++ b/webroot/rsrc/js/application/repository/repository-crossreference.js @@ -237,11 +237,6 @@ JX.behavior('repository-crossreference', function(config, statics) { } var content = '' + node.textContent; - - // Strip off any ZWS characters. These are marker characters used to - // improve copy/paste behavior. - content = content.replace(/\u200B/g, ''); - char += content.length; }