mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 11:22:40 +01:00
fe7047d12d
Summary: Ref T12822. Ref T2495. This is the good version of D20193. Currently, we display various nonprintable characters (ZWS, nonbreaking space, various control characters) as themselves, so they're generally invisible. In T12822, one user reports that all their engineers frequently type ZWS characters into source somehow? I don't really believe this (??), and this should be fixed in lint. That said, the only real reason not to show these weird characters in a special way was that it would break copy/paste: if we render ZWS as "🐑", and a user copy-pastes the line including the ZWS, they'll get a sheep. At least, they would have, until D20191. Now that this whole thing is end-to-end Javascript magic, we can copy whatever we want. In particular, we can render any character `X` as `<span data-copy-text="Y">X</span>`, and then copy "Y" instead of "X" when the user copies the node. Limitations: - If users select only "X", they'll get "X" on their clipboard. This seems fine. If you're selecting our ZWS marker *only*, you probably want to copy it? - If "X" is more than one character long, users will get the full "Y" if they select any part of "X". At least here, this only matters when "X" is several spaces and "Y" is a tab. This also seems fine. - We have to be kind of careful because this approach involves editing an HTML blob directly. However, we already do that elsewhere and this isn't really too hard to get right. With those tools in hand: - Replace "\t" (raw text / what gets copied) with the number of spaces to the next tab stop for display. - Replace ZWS and NBSP (raw text) with a special marker for display. - Replace control characters 0x00-0x19 and 0x7F, except for "\t", "\r", and "\n", with the special unicode "control character pictures" reserved for this purpose. Test Plan: - Generated and viewed a file like this one: {F6220422} - Copied text out of it, got authentic raw original source text instead of displayed text. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T12822, T2495 Differential Revision: https://secure.phabricator.com/D20194 |
||
---|---|---|
.. | ||
darkconsole | ||
behavior-active-nav.js | ||
behavior-audio-source.js | ||
behavior-autofocus.js | ||
behavior-badge-view.js | ||
behavior-bulk-editor.js | ||
behavior-choose-control.js | ||
behavior-copy.js | ||
behavior-detect-timezone.js | ||
behavior-device.js | ||
behavior-drag-and-drop-textarea.js | ||
behavior-fancy-datepicker.js | ||
behavior-file-tree.js | ||
behavior-form.js | ||
behavior-gesture.js | ||
behavior-global-drag-and-drop.js | ||
behavior-high-security-warning.js | ||
behavior-history-install.js | ||
behavior-hovercard.js | ||
behavior-keyboard-pager.js | ||
behavior-keyboard-shortcuts.js | ||
behavior-lightbox-attachments.js | ||
behavior-line-linker.js | ||
behavior-linked-container.js | ||
behavior-more.js | ||
behavior-object-selector.js | ||
behavior-oncopy.js | ||
behavior-phabricator-nav.js | ||
behavior-phabricator-remarkup-assist.js | ||
behavior-read-only-warning.js | ||
behavior-redirect.js | ||
behavior-refresh-csrf.js | ||
behavior-remarkup-load-image.js | ||
behavior-remarkup-preview.js | ||
behavior-reorder-applications.js | ||
behavior-reveal-content.js | ||
behavior-scrollbar.js | ||
behavior-search-typeahead.js | ||
behavior-select-content.js | ||
behavior-select-on-click.js | ||
behavior-setup-check-https.js | ||
behavior-time-typeahead.js | ||
behavior-toggle-class.js | ||
behavior-tokenizer.js | ||
behavior-tooltip.js | ||
behavior-user-menu.js | ||
behavior-watch-anchor.js | ||
behavior-workflow.js | ||
Busy.js | ||
DragAndDropFileUpload.js | ||
DraggableList.js | ||
Favicon.js | ||
FileUpload.js | ||
Hovercard.js | ||
KeyboardShortcut.js | ||
KeyboardShortcutManager.js | ||
MultirowRowManager.js | ||
Notification.js | ||
phtize.js | ||
Prefab.js | ||
ShapedRequest.js | ||
TextAreaUtils.js | ||
Title.js | ||
ToolTip.js |