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
F14315648: D15469.id37283.diff
Wed, Dec 18, 6:23 AM
F14315647: D15469.id37282.diff
Wed, Dec 18, 6:22 AM
Unknown Object (File)
Wed, Nov 27, 2:29 PM
Unknown Object (File)
Tue, Nov 26, 11:09 PM
Unknown Object (File)
Sun, Nov 24, 8:15 PM
Unknown Object (File)
Thu, Nov 21, 11:23 PM
Unknown Object (File)
Thu, Nov 21, 6:55 PM
Unknown Object (File)
Tue, Nov 19, 5:53 AM
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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.