adobe/brackets — pull request #1019 by tvoliter (2012-06-08 21:04:55+00:00)
Title: Offset to line number optimization

A lot of places in our code convert an offset into a string into a line number. Many places in our code do this in a loop and split the text into lines every iteration which is inefficient. This change centralizes this logic in StringUtils and provides an optimized version for loops that caches the lines.

Added functions:
StringUtils.offsetToLineNumForLoops()
StringUtils.offsetToLineNumFor()

I am curious to see if the JS quick edit perf tests show a difference with this change.

I also moved format() from Strings.js to StringUtils.js as a cleanup task