Skip to content

Commit d4b96bc

Browse files
author
epriestley
committed
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
1 parent 98fe8fa commit d4b96bc

File tree

4 files changed

+16
-34
lines changed

4 files changed

+16
-34
lines changed

resources/celerity/map.php

+15-15
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
'conpherence.pkg.js' => '020aebcf',
1212
'core.pkg.css' => '261ee8cf',
1313
'core.pkg.js' => '5ace8a1e',
14-
'differential.pkg.css' => '801c5653',
15-
'differential.pkg.js' => '1f211736',
14+
'differential.pkg.css' => 'fcc82bc0',
15+
'differential.pkg.js' => '0e2b0e2c',
1616
'diffusion.pkg.css' => '42c75c37',
1717
'diffusion.pkg.js' => '91192d85',
1818
'maniphest.pkg.css' => '35995d6d',
@@ -61,7 +61,7 @@
6161
'rsrc/css/application/dashboard/dashboard.css' => '4267d6c6',
6262
'rsrc/css/application/diff/inline-comment-summary.css' => '81eb368d',
6363
'rsrc/css/application/differential/add-comment.css' => '7e5900d9',
64-
'rsrc/css/application/differential/changeset-view.css' => '8a997ed9',
64+
'rsrc/css/application/differential/changeset-view.css' => '58236820',
6565
'rsrc/css/application/differential/core.css' => 'bdb93065',
6666
'rsrc/css/application/differential/phui-inline-comment.css' => '48acce5b',
6767
'rsrc/css/application/differential/revision-comment.css' => '7dbc8d1d',
@@ -420,7 +420,7 @@
420420
'rsrc/js/application/releeph/releeph-preview-branch.js' => '75184d68',
421421
'rsrc/js/application/releeph/releeph-request-state-change.js' => '9f081f05',
422422
'rsrc/js/application/releeph/releeph-request-typeahead.js' => 'aa3a100c',
423-
'rsrc/js/application/repository/repository-crossreference.js' => 'db0c0214',
423+
'rsrc/js/application/repository/repository-crossreference.js' => 'c15122b4',
424424
'rsrc/js/application/search/behavior-reorder-profile-menu-items.js' => 'e5bdb730',
425425
'rsrc/js/application/search/behavior-reorder-queries.js' => 'b86f297f',
426426
'rsrc/js/application/transactions/behavior-comment-actions.js' => '4dffaeb2',
@@ -541,7 +541,7 @@
541541
'conpherence-thread-manager' => 'aec8e38c',
542542
'conpherence-transaction-css' => '3a3f5e7e',
543543
'd3' => 'd67475f5',
544-
'differential-changeset-view-css' => '8a997ed9',
544+
'differential-changeset-view-css' => '58236820',
545545
'differential-core-view-css' => 'bdb93065',
546546
'differential-revision-add-comment-css' => '7e5900d9',
547547
'differential-revision-comment-css' => '7dbc8d1d',
@@ -671,7 +671,7 @@
671671
'javelin-behavior-reorder-applications' => 'aa371860',
672672
'javelin-behavior-reorder-columns' => '8ac32fd9',
673673
'javelin-behavior-reorder-profile-menu-items' => 'e5bdb730',
674-
'javelin-behavior-repository-crossreference' => 'db0c0214',
674+
'javelin-behavior-repository-crossreference' => 'c15122b4',
675675
'javelin-behavior-scrollbar' => '92388bae',
676676
'javelin-behavior-search-reorder-queries' => 'b86f297f',
677677
'javelin-behavior-select-content' => 'e8240b50',
@@ -1380,6 +1380,9 @@
13801380
'javelin-vector',
13811381
'javelin-typeahead-static-source',
13821382
),
1383+
58236820 => array(
1384+
'phui-inline-comment-view-css',
1385+
),
13831386
'5902260c' => array(
13841387
'javelin-util',
13851388
'javelin-magical-init',
@@ -1587,9 +1590,6 @@
15871590
'8a16f91b' => array(
15881591
'syntax-default-css',
15891592
),
1590-
'8a997ed9' => array(
1591-
'phui-inline-comment-view-css',
1592-
),
15931593
'8ac32fd9' => array(
15941594
'javelin-behavior',
15951595
'javelin-stratcom',
@@ -1912,6 +1912,12 @@
19121912
'c03f2fb4' => array(
19131913
'javelin-install',
19141914
),
1915+
'c15122b4' => array(
1916+
'javelin-behavior',
1917+
'javelin-dom',
1918+
'javelin-stratcom',
1919+
'javelin-uri',
1920+
),
19151921
'c2c500a7' => array(
19161922
'javelin-install',
19171923
'javelin-dom',
@@ -2008,12 +2014,6 @@
20082014
'javelin-uri',
20092015
'phabricator-notification',
20102016
),
2011-
'db0c0214' => array(
2012-
'javelin-behavior',
2013-
'javelin-dom',
2014-
'javelin-stratcom',
2015-
'javelin-uri',
2016-
),
20172017
'dfa1d313' => array(
20182018
'javelin-behavior',
20192019
'javelin-dom',

src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php

+1-9
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,6 @@ public function renderTextChange(
301301
}
302302
}
303303

304-
// NOTE: This is a unicode zero-width space, which we use as a hint when
305-
// intercepting 'copy' events to make sure sensible text ends up on the
306-
// clipboard. See the 'phabricator-oncopy' behavior.
307-
$zero_space = "\xE2\x80\x8B";
308-
309304
$old_number = phutil_tag(
310305
'td',
311306
array(
@@ -330,10 +325,7 @@ public function renderTextChange(
330325
phutil_tag(
331326
'td',
332327
array('class' => $n_classes, 'colspan' => $n_colspan),
333-
array(
334-
phutil_tag('span', array('class' => 'zwsp'), $zero_space),
335-
$n_text,
336-
)),
328+
$n_text),
337329
$n_cov,
338330
));
339331

webroot/rsrc/css/application/differential/changeset-view.css

-5
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@
6767
padding: 1px 4px;
6868
}
6969

70-
.differential-diff td .zwsp {
71-
position: absolute;
72-
width: 0;
73-
}
74-
7570
.prose-diff {
7671
padding: 12px 0;
7772
white-space: pre-wrap;

webroot/rsrc/js/application/repository/repository-crossreference.js

-5
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,6 @@ JX.behavior('repository-crossreference', function(config, statics) {
237237
}
238238

239239
var content = '' + node.textContent;
240-
241-
// Strip off any ZWS characters. These are marker characters used to
242-
// improve copy/paste behavior.
243-
content = content.replace(/\u200B/g, '');
244-
245240
char += content.length;
246241
}
247242

0 commit comments

Comments
 (0)