SearchManager.as : 41
var startCharIndex:int = TextUtil.lineCharIdx2charIdx(
str,
startLine,
startChar,
editor.lineDelim);
For large files, and some others, this tend to return 0 instead of actual char
index when you try to use it for high numbers.
If you open DataGrid.as and search for 'var' then search backwards it'll hit
the LAST var (since that's always done if no match is found, code-wise, for
stepping backwards). The reason it can't anything else is that startCharIndex
is 0, for reasons unknown.
Could be that the file has different line endings, so the RegExp fails since it
doesn't have that amount of lines (according to the regexp).
TextUtil.as:
// Return charIdx from lineIdx/charIdx
public static function lineCharIdx2charIdx(str:String, lineIdx:int, charIdx:int, lineDelim:String):int
{
return str.length - str.replace(new RegExp("^(.*?"+lineDelim+"){"+lineIdx+"}.{"+charIdx+"}"),"").length;
}
That would be the code that doesn't do what it should, but as earlier stated it
might also be the line endings that don't line up (in which case we need to
double check that we neuter the line endings).
Original issue reported on code.google.com by petterson.erik@gmail.com on 21 Sep 2010 at 8:59
Original issue reported on code.google.com by
petterson.erik@gmail.com
on 21 Sep 2010 at 8:59