Page MenuHomePhabricator

Fix an issue with highlighting PHP snippets with leading whitespace using XHPAST
ClosedPublic

Authored by epriestley on Mar 13 2016, 2:07 PM.
Tags
None
Referenced Files
F14076626: D15469.diff
Thu, Nov 21, 6:55 PM
Unknown Object (File)
Tue, Nov 19, 5:53 AM
Unknown Object (File)
Fri, Nov 15, 2:14 AM
Unknown Object (File)
Tue, Nov 5, 6:58 AM
Unknown Object (File)
Tue, Nov 5, 4:36 AM
Unknown Object (File)
Sun, Oct 27, 6:15 AM
Unknown Object (File)
Thu, Oct 24, 3:17 AM
Unknown Object (File)
Tue, Oct 22, 10:13 PM
Subscribers
None

Details

Summary

Ref T10576. In the test case there, XHPAST has incorrectly emitted an extra newline at the top of the output.

This cascades downward and throws every line off by one, highlighting the wrong lines in the output.

Fix this issue by stripping the prefix more carefully, so the input source is preserved accurately.

Test Plan
  • Added tests; ran tests.
  • Verified that the snippet now highlights correctly.

Screen Shot 2016-03-13 at 7.05.29 AM.png (890×2 px, 195 KB)

Diff Detail

Repository
rPHU libphutil
Branch
hsnippet1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 11147
Build 13818: Run Core Tests
Build 13817: arc lint + arc unit

Event Timeline

epriestley retitled this revision from to Fix an issue with highlighting PHP snippets with leading whitespace using XHPAST.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
chad edited edge metadata.
This revision is now accepted and ready to land.Mar 13 2016, 2:43 PM
This revision was automatically updated to reflect the committed changes.