1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 16:58:48 +02:00

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
This commit is contained in:
epriestley 2019-02-17 04:06:27 -08:00
parent 98fe8fae4a
commit d4b96bcf6b
4 changed files with 16 additions and 34 deletions

View file

@ -11,8 +11,8 @@ return array(
'conpherence.pkg.js' => '020aebcf', 'conpherence.pkg.js' => '020aebcf',
'core.pkg.css' => '261ee8cf', 'core.pkg.css' => '261ee8cf',
'core.pkg.js' => '5ace8a1e', 'core.pkg.js' => '5ace8a1e',
'differential.pkg.css' => '801c5653', 'differential.pkg.css' => 'fcc82bc0',
'differential.pkg.js' => '1f211736', 'differential.pkg.js' => '0e2b0e2c',
'diffusion.pkg.css' => '42c75c37', 'diffusion.pkg.css' => '42c75c37',
'diffusion.pkg.js' => '91192d85', 'diffusion.pkg.js' => '91192d85',
'maniphest.pkg.css' => '35995d6d', 'maniphest.pkg.css' => '35995d6d',
@ -61,7 +61,7 @@ return array(
'rsrc/css/application/dashboard/dashboard.css' => '4267d6c6', 'rsrc/css/application/dashboard/dashboard.css' => '4267d6c6',
'rsrc/css/application/diff/inline-comment-summary.css' => '81eb368d', 'rsrc/css/application/diff/inline-comment-summary.css' => '81eb368d',
'rsrc/css/application/differential/add-comment.css' => '7e5900d9', '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/core.css' => 'bdb93065',
'rsrc/css/application/differential/phui-inline-comment.css' => '48acce5b', 'rsrc/css/application/differential/phui-inline-comment.css' => '48acce5b',
'rsrc/css/application/differential/revision-comment.css' => '7dbc8d1d', '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-preview-branch.js' => '75184d68',
'rsrc/js/application/releeph/releeph-request-state-change.js' => '9f081f05', 'rsrc/js/application/releeph/releeph-request-state-change.js' => '9f081f05',
'rsrc/js/application/releeph/releeph-request-typeahead.js' => 'aa3a100c', '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-profile-menu-items.js' => 'e5bdb730',
'rsrc/js/application/search/behavior-reorder-queries.js' => 'b86f297f', 'rsrc/js/application/search/behavior-reorder-queries.js' => 'b86f297f',
'rsrc/js/application/transactions/behavior-comment-actions.js' => '4dffaeb2', 'rsrc/js/application/transactions/behavior-comment-actions.js' => '4dffaeb2',
@ -541,7 +541,7 @@ return array(
'conpherence-thread-manager' => 'aec8e38c', 'conpherence-thread-manager' => 'aec8e38c',
'conpherence-transaction-css' => '3a3f5e7e', 'conpherence-transaction-css' => '3a3f5e7e',
'd3' => 'd67475f5', 'd3' => 'd67475f5',
'differential-changeset-view-css' => '8a997ed9', 'differential-changeset-view-css' => '58236820',
'differential-core-view-css' => 'bdb93065', 'differential-core-view-css' => 'bdb93065',
'differential-revision-add-comment-css' => '7e5900d9', 'differential-revision-add-comment-css' => '7e5900d9',
'differential-revision-comment-css' => '7dbc8d1d', 'differential-revision-comment-css' => '7dbc8d1d',
@ -671,7 +671,7 @@ return array(
'javelin-behavior-reorder-applications' => 'aa371860', 'javelin-behavior-reorder-applications' => 'aa371860',
'javelin-behavior-reorder-columns' => '8ac32fd9', 'javelin-behavior-reorder-columns' => '8ac32fd9',
'javelin-behavior-reorder-profile-menu-items' => 'e5bdb730', 'javelin-behavior-reorder-profile-menu-items' => 'e5bdb730',
'javelin-behavior-repository-crossreference' => 'db0c0214', 'javelin-behavior-repository-crossreference' => 'c15122b4',
'javelin-behavior-scrollbar' => '92388bae', 'javelin-behavior-scrollbar' => '92388bae',
'javelin-behavior-search-reorder-queries' => 'b86f297f', 'javelin-behavior-search-reorder-queries' => 'b86f297f',
'javelin-behavior-select-content' => 'e8240b50', 'javelin-behavior-select-content' => 'e8240b50',
@ -1380,6 +1380,9 @@ return array(
'javelin-vector', 'javelin-vector',
'javelin-typeahead-static-source', 'javelin-typeahead-static-source',
), ),
58236820 => array(
'phui-inline-comment-view-css',
),
'5902260c' => array( '5902260c' => array(
'javelin-util', 'javelin-util',
'javelin-magical-init', 'javelin-magical-init',
@ -1587,9 +1590,6 @@ return array(
'8a16f91b' => array( '8a16f91b' => array(
'syntax-default-css', 'syntax-default-css',
), ),
'8a997ed9' => array(
'phui-inline-comment-view-css',
),
'8ac32fd9' => array( '8ac32fd9' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-stratcom', 'javelin-stratcom',
@ -1912,6 +1912,12 @@ return array(
'c03f2fb4' => array( 'c03f2fb4' => array(
'javelin-install', 'javelin-install',
), ),
'c15122b4' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-uri',
),
'c2c500a7' => array( 'c2c500a7' => array(
'javelin-install', 'javelin-install',
'javelin-dom', 'javelin-dom',
@ -2008,12 +2014,6 @@ return array(
'javelin-uri', 'javelin-uri',
'phabricator-notification', 'phabricator-notification',
), ),
'db0c0214' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-uri',
),
'dfa1d313' => array( 'dfa1d313' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-dom', 'javelin-dom',

View file

@ -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( $old_number = phutil_tag(
'td', 'td',
array( array(
@ -330,10 +325,7 @@ final class DifferentialChangesetTwoUpRenderer
phutil_tag( phutil_tag(
'td', 'td',
array('class' => $n_classes, 'colspan' => $n_colspan), array('class' => $n_classes, 'colspan' => $n_colspan),
array( $n_text),
phutil_tag('span', array('class' => 'zwsp'), $zero_space),
$n_text,
)),
$n_cov, $n_cov,
)); ));

View file

@ -67,11 +67,6 @@
padding: 1px 4px; padding: 1px 4px;
} }
.differential-diff td .zwsp {
position: absolute;
width: 0;
}
.prose-diff { .prose-diff {
padding: 12px 0; padding: 12px 0;
white-space: pre-wrap; white-space: pre-wrap;

View file

@ -237,11 +237,6 @@ JX.behavior('repository-crossreference', function(config, statics) {
} }
var content = '' + node.textContent; 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; char += content.length;
} }