Skip to content

Commit a1ec516

Browse files
author
Kapil Borle
committed
Add a property to return the number of lines in TextLines
1 parent d796058 commit a1ec516

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Engine/EditableText.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ public class EditableText
1616
{
1717
private TextLines lines { get; set; }
1818

19+
/// <summary>
20+
/// Return the number of lines in the text.
21+
/// </summary>
22+
public int LineCount => lines.Count;
23+
1924
/// <summary>
2025
/// The text that is available for editing.
2126
/// </summary>

Engine/ScriptAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,7 +1569,7 @@ public EditableText Fix(EditableText text, Range range, out Range updatedRange)
15691569
}
15701570

15711571
range = isRangeNull ? null : SnapToEdges(text, range);
1572-
var previousLineCount = text.Lines.Length;
1572+
var previousLineCount = text.LineCount;
15731573
var previousUnusedCorrections = 0;
15741574
do
15751575
{
@@ -1600,7 +1600,7 @@ public EditableText Fix(EditableText text, Range range, out Range updatedRange)
16001600
previousUnusedCorrections = unusedCorrections;
16011601

16021602
// todo add a TextLines.NumLines property because accessing TextLines.Lines is expensive
1603-
var lineCount = text.Lines.Length;
1603+
var lineCount = text.LineCount;
16041604
if (!isRangeNull && lineCount != previousLineCount)
16051605
{
16061606
range = new Range(

0 commit comments

Comments
 (0)