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

In source views, wrap display tabs in "user-select: all" to improve cursor selection behavior

Summary:
Ref T2495. See PHI1814. Currently, Phabricator replaces tabs with spaces when rendering diffs.

This may or may not be the best behavior in the long term, but it gives us more control over expansion of tabs than using tab literals.

However, one downside is that you can use your mouse cursor to select "half a tab", and can't use your mouse cursor to distinguish between tabs and spaces. Although you probably shouldn't be doing this, this behavior is less accurate/correct than selecting the entire block as a single unit.

A specific correctness issue with this behavior is that the entire block is copied to the clipboard as a tab literal if you select any of it, so two different visual selection ranges can produce the same clipboard content.

This particular behavior can be improved with "user-select: all", to instruct browsers to select the entire element as a single logical element. Now, selecting part of the tab selects the whole thing, as though it were really a tab literal.

(Some future change might abandon this approach and opt to use real tab literals with "tab-size" CSS, but we lose some ability to control alignment behavior if we do that and it doesn't have any obvious advantages over this approach other than cursor selection behavior.)

Test Plan:
- In Safari and Firefox, dragged text to select a whitespace-expanded tab literal. Saw browsers select the whole sequence as though it were a single tab.
- In Chorme, this also mostly works, but there's some glitchiness and flickering. I think this is still a net improvement, it's just not as smooth as Safari and Firefox.

Maniphest Tasks: T2495

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

+20 -8
+6 -6
resources/celerity/map.php
··· 9 9 'names' => array( 10 10 'conpherence.pkg.css' => '0e3cf785', 11 11 'conpherence.pkg.js' => '020aebcf', 12 - 'core.pkg.css' => 'da792a0f', 12 + 'core.pkg.css' => '2e175364', 13 13 'core.pkg.js' => '845355f4', 14 14 'dark-console.pkg.js' => '187792c2', 15 15 'differential.pkg.css' => '5c459f92', ··· 115 115 'rsrc/css/application/uiexample/example.css' => 'b4795059', 116 116 'rsrc/css/core/core.css' => '1b29ed61', 117 117 'rsrc/css/core/remarkup.css' => '7d3ebc86', 118 - 'rsrc/css/core/syntax.css' => '548567f6', 118 + 'rsrc/css/core/syntax.css' => '98fdb17e', 119 119 'rsrc/css/core/z-index.css' => 'ac3bfcd4', 120 120 'rsrc/css/diviner/diviner-shared.css' => '4bd263b0', 121 121 'rsrc/css/font/font-awesome.css' => '3883938a', ··· 909 909 'sprite-login-css' => '18b368a6', 910 910 'sprite-tokens-css' => 'f1896dc5', 911 911 'syntax-default-css' => '055fc231', 912 - 'syntax-highlighting-css' => '548567f6', 912 + 'syntax-highlighting-css' => '98fdb17e', 913 913 'tokens-css' => 'ce5a50bd', 914 914 'trigger-rule' => '41b7b4f6', 915 915 'trigger-rule-control' => '5faf27b9', ··· 1422 1422 'phuix-autocomplete', 1423 1423 'javelin-mask', 1424 1424 ), 1425 - '548567f6' => array( 1426 - 'syntax-default-css', 1427 - ), 1428 1425 '55a24e84' => array( 1429 1426 'javelin-install', 1430 1427 'javelin-dom', ··· 1802 1799 'javelin-dom', 1803 1800 'javelin-request', 1804 1801 'javelin-util', 1802 + ), 1803 + '98fdb17e' => array( 1804 + 'syntax-default-css', 1805 1805 ), 1806 1806 '995f5102' => array( 1807 1807 'javelin-install',
+7
src/applications/differential/parser/DifferentialChangesetParser.php
··· 1600 1600 'span', 1601 1601 array( 1602 1602 'data-copy-text' => "\t", 1603 + 1604 + // See PHI1814. Mark this as a single logical tab for the purposes 1605 + // of text selection behavior: when the user drags their mouse over 1606 + // the character sequence, we'd like the whole thing to select as 1607 + // a single unit. 1608 + 1609 + 'class' => 'logical-tab', 1603 1610 ), 1604 1611 str_repeat(' ', $ii)); 1605 1612 $tag = phutil_string_cast($tag);
+2 -2
src/applications/differential/parser/__tests__/DifferentialTabReplacementTestCase.php
··· 4 4 extends PhabricatorTestCase { 5 5 6 6 public function testTabReplacement() { 7 - $tab1 = "<span data-copy-text=\"\t\"> </span>"; 8 - $tab2 = "<span data-copy-text=\"\t\"> </span>"; 7 + $tab1 = "<span data-copy-text=\"\t\" class=\"logical-tab\"> </span>"; 8 + $tab2 = "<span data-copy-text=\"\t\" class=\"logical-tab\"> </span>"; 9 9 10 10 $cat = "\xF0\x9F\x90\xB1"; 11 11
+5
webroot/rsrc/css/core/syntax.css
··· 39 39 color: #ffffff; 40 40 cursor: default; 41 41 } 42 + 43 + .logical-tab { 44 + user-select: all; 45 + -webkit-user-select: all; 46 + }