From d4fc24b389e239d0c6ed6e034a0c7824e47fe78d Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 25 Nov 2018 21:18:58 +0100 Subject: [PATCH] Fixes Source Text length being off by the length of a newline --- Upsilon/Text/SourceText.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Upsilon/Text/SourceText.cs b/Upsilon/Text/SourceText.cs index f050680..ce3b232 100644 --- a/Upsilon/Text/SourceText.cs +++ b/Upsilon/Text/SourceText.cs @@ -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; } }