Page MenuHomePhabricator

ArcanistLintEngine::getLineAndCharFromOffset(string, integer) returns the wrong values
Closed, InvalidPublic

Description

ArcanistLintEngine::getLineAndCharFromOffset(string, integer) returns the wrong values for offsets in my test file.

Reproduction steps:

  1. Make an ArcanistLintEngine object
  2. list($line, $char) = $engine->getLineAndCharFromOffset('path/to/project.pbxproj', 13413);

Expected result:

  • $line === 221, $char === 0

Actual result:

  • $line === 220, $char === 5

Event Timeline

Actually I think this is my fault, I was providing the offset in Unicode characters, not in bytes.

avivey added a subscriber: avivey.

Closing, because it's probably not a bug. Comment again if you think it is. But if you do, a smaller file would help debugging.