Page MenuHomePhabricator

Break long words in differential two-up view
ClosedPublic

Authored by sophiebits on Apr 3 2014, 7:30 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 15, 6:03 PM
Unknown Object (File)
Wed, Dec 11, 4:59 AM
Unknown Object (File)
Fri, Dec 6, 3:28 PM
Unknown Object (File)
Fri, Dec 6, 5:13 AM
Unknown Object (File)
Tue, Dec 3, 11:35 PM
Unknown Object (File)
Sat, Nov 30, 1:30 AM
Unknown Object (File)
Tue, Nov 26, 1:54 PM
Unknown Object (File)
Tue, Nov 26, 1:53 PM

Details

Reviewers
epriestley
chad
Group Reviewers
Blessed Reviewers
Maniphest Tasks
Restricted Maniphest Task
Commits
Restricted Diffusion Commit
rP9fedd343eb18: Break long words in differential two-up view
Summary

This should prevent long lines from making the code width different between files, which can be annoying. (And of course, it stops long lines from making a giant scrollbar too.)

Test Plan

Loaded this diff in Chrome, Firefox, IE9, and IE8:

undefined (541×950 px, 134 KB)

(That's a screenshot from Chrome, but it looks about the same in the other browsers.)

Diff Detail

Repository
rP Phabricator
Branch
diff-break-word
Lint
Lint Passed
Unit
Tests Passed

Event Timeline

sophiebits retitled this revision from to Break long words in differential two-up view.
sophiebits updated this object.
sophiebits edited the test plan for this revision. (Show Details)
sophiebits added reviewers: chad, epriestley.
sophiebits added a task: Restricted Maniphest Task.
sophiebits edited edge metadata.

Switch to unicode 'word joiner' (essentially a non-breaking zero-width space) so there's no extra line break when a line starts a really long word. Now looks like:

{F137518}

Note that the line number in beta.txt lines up with the line. (Tested copying in Chrome, Firefox, IE9. IE8 already didn't work.)

What does this do on iOS/mobile?

About the same as before, but with line breaking. Here's an example that has some red.

undefined (1×640 px, 114 KB)

When you scroll over, it looks reasonable too:

undefined (1×640 px, 116 KB)

i'd defer to @epriestley, not sure how purposeful it is to not break words - it would be my guess someone will dislike this behaviour change - but I might be wrong, haha.

Well, this only changes the behavior in the case of a single word that's wider than the diff window; if it can avoid breaking a word by wrapping it still will. Does your text editor not do the same? I just tested in vim, emacs, TextMate, and Atom and all of them seem to break long words when necessary.

epriestley edited edge metadata.

One technical issue in two places:

  • PhabricatorSourceCodeView also uses phabricator-oncopy, but it looks like it wasn't updated, so I'd expect this to break copying text in Paste -- switch the ZWS in PhabricatorSourceCodeView to Word Joiner.
  • Likewise, DiffusionBrowseFileController has a copy of this character too. Update that one.

A couple minor things inline.

Also, some browsers (Chromium only?) have unusual behavior for <zero width space> <tab literal> (see https://secure.phabricator.com/T2495#26). This might interact in those cases, but hopefully by accidentally fixing the issue.

src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
355

Can we safely remove any of these column classes now?

437

Do images still display OK?

This revision now requires changes to proceed.Apr 3 2014, 4:18 PM

I can't reproduce the tab problem in Chrome beta on OS X and I don't have Chromium on Ubuntu handy, but hopefully nothing will break terribly there.

src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
355

Yes! I meant to and forgot.

437

Oops, they're a little funky. I'll fix.

sophiebits edited edge metadata.

Fix images, remove extraneous classes, fix copying out of pastes

epriestley edited edge metadata.

Thanks! Based on the expert strategy of "poking around for 20 seconds", I don't see this causing any display issues. This is pretty easy to adjust later if we missed something, too.

This revision is now accepted and ready to land.Apr 3 2014, 4:39 PM
epriestley updated this revision to Diff 20608.

Closed by commit rP9fedd343eb18 (authored by @spicyj, committed by @epriestley).

I think this mucked up generated changes a little bit -- I get this in Safari if I click to show generated changes on a diff like D8646, for the file __phutil_library_map__.php. I can look at this when I get a chance, but you can repro locally by putting @generated in any file and diffing it if you get there first.

Screen_Shot_2014-04-03_at_2.30.36_PM.png (502×1 px, 80 KB)