Fixes Source Text length being off by the length of a newline
This commit is contained in:
parent
5f9c32874a
commit
d4fc24b389
|
@ -10,14 +10,14 @@ namespace Upsilon.Text
|
|||
public SourceText(string text)
|
||||
{
|
||||
_text = text;
|
||||
var lines = text.Split('\n');
|
||||
var lines = text.Split(new[] {Environment.NewLine}, StringSplitOptions.None);
|
||||
_lines = new SourceTextLine[lines.Length];
|
||||
var linePos = 0;
|
||||
for (var index = 0; index < lines.Length; index++)
|
||||
{
|
||||
var line = lines[index];
|
||||
_lines[index] = new SourceTextLine(linePos, line.Length);
|
||||
linePos += line.Length;
|
||||
_lines[index] = new SourceTextLine(linePos, line.Length + Environment.NewLine.Length);
|
||||
linePos += line.Length + Environment.NewLine.Length;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue