Permalink
Browse files

Move the list of line delimiters to NewLineFinder.

  • Loading branch information...
1 parent 65a130c commit d071c68a8d0e29b317e72b4d6331092c4b120f10 @dgrunwald dgrunwald committed Dec 7, 2011
@@ -12,6 +12,8 @@ static class NewLineFinder
{
static readonly char[] newline = { '\r', '\n' };
+ internal static readonly string[] NewlineStrings = { "\r\n", "\r", "\n" };
+
/// <summary>
/// Gets the location of the next new line character, or SimpleSegment.Invalid
/// if none is found.
@@ -210,7 +210,7 @@ public override void ReplaceSelectionWithText(string newText)
textArea.Selection = new RectangleSelection(textArea, pos, Math.Max(startLine, endLine), GetXPos(textArea, pos));
} else {
- string[] lines = newText.Split(new[] { "\r\n", "\r", "\n" }, segments.Count, StringSplitOptions.None);
+ string[] lines = newText.Split(NewLineFinder.NewlineStrings, segments.Count, StringSplitOptions.None);
int line = Math.Min(startLine, endLine);
for (int i = lines.Length - 1; i >= 0; i--) {
ReplaceSingleLineText(textArea, segments[i], lines[i], out insertionLength);

0 comments on commit d071c68

Please sign in to comment.