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
F14004973: D15469.id37283.diff
Sun, Oct 27, 6:15 AM
F13997265: D15469.id37283.diff
Thu, Oct 24, 3:17 AM
F13993338: D15469.id.diff
Tue, Oct 22, 10:13 PM
F13963764: D15469.id37282.diff
Tue, Oct 15, 5:46 PM
Unknown Object (File)
Thu, Oct 10, 8:57 PM
Unknown Object (File)
Sep 30 2024, 8:11 PM
Unknown Object (File)
Sep 18 2024, 9:34 PM
Unknown Object (File)
Sep 15 2024, 9:14 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.