Browse Source

Skip folds that only span a single line

pull/2276/head
Siegfried Pammer 5 years ago
parent
commit
c4930a81b5
  1. 11
      ILSpy/TextView/AvalonEditTextOutput.cs

11
ILSpy/TextView/AvalonEditTextOutput.cs

@ -99,7 +99,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -99,7 +99,7 @@ namespace ICSharpCode.ILSpy.TextView
TextSegmentCollection<ReferenceSegment> references = new TextSegmentCollection<ReferenceSegment>();
/// <summary>Stack of the fold markers that are open but not closed yet</summary>
Stack<NewFolding> openFoldings = new Stack<NewFolding>();
Stack<(NewFolding, int startLine)> openFoldings = new Stack<(NewFolding, int startLine)>();
/// <summary>List of all foldings that were written to the output</summary>
internal readonly List<NewFolding> Foldings = new List<NewFolding>();
@ -315,19 +315,20 @@ namespace ICSharpCode.ILSpy.TextView @@ -315,19 +315,20 @@ namespace ICSharpCode.ILSpy.TextView
public void MarkFoldStart(string collapsedText = "...", bool defaultCollapsed = false)
{
WriteIndent();
openFoldings.Push(
openFoldings.Push((
new NewFolding {
StartOffset = this.TextLength,
Name = collapsedText,
DefaultClosed = defaultCollapsed
});
}, lineNumber));
}
public void MarkFoldEnd()
{
NewFolding f = openFoldings.Pop();
var (f, startLine) = openFoldings.Pop();
f.EndOffset = this.TextLength;
this.Foldings.Add(f);
if (startLine != lineNumber)
this.Foldings.Add(f);
}
public void AddUIElement(Func<UIElement> element)

Loading…
Cancel
Save