Skip to content

Commit c4930a8

Browse files
Skip folds that only span a single line
1 parent b6ed312 commit c4930a8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ILSpy/TextView/AvalonEditTextOutput.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public sealed class AvalonEditTextOutput : ISmartTextOutput
9999
TextSegmentCollection<ReferenceSegment> references = new TextSegmentCollection<ReferenceSegment>();
100100

101101
/// <summary>Stack of the fold markers that are open but not closed yet</summary>
102-
Stack<NewFolding> openFoldings = new Stack<NewFolding>();
102+
Stack<(NewFolding, int startLine)> openFoldings = new Stack<(NewFolding, int startLine)>();
103103

104104
/// <summary>List of all foldings that were written to the output</summary>
105105
internal readonly List<NewFolding> Foldings = new List<NewFolding>();
@@ -315,19 +315,20 @@ public void WriteLocalReference(string text, object reference, bool isDefinition
315315
public void MarkFoldStart(string collapsedText = "...", bool defaultCollapsed = false)
316316
{
317317
WriteIndent();
318-
openFoldings.Push(
318+
openFoldings.Push((
319319
new NewFolding {
320320
StartOffset = this.TextLength,
321321
Name = collapsedText,
322322
DefaultClosed = defaultCollapsed
323-
});
323+
}, lineNumber));
324324
}
325325

326326
public void MarkFoldEnd()
327327
{
328-
NewFolding f = openFoldings.Pop();
328+
var (f, startLine) = openFoldings.Pop();
329329
f.EndOffset = this.TextLength;
330-
this.Foldings.Add(f);
330+
if (startLine != lineNumber)
331+
this.Foldings.Add(f);
331332
}
332333

333334
public void AddUIElement(Func<UIElement> element)

0 commit comments

Comments
 (0)