Browse Source

Fixed bug in FoldingManager.RemoveFromTextView().

An uninstalled folding manager would stay partially connected to the text view, which could cause the InvalidOperationException: "Trying to build visual line from collapsed line".
pull/28/head
Daniel Grunwald 13 years ago
parent
commit
fe9ad47bce
  1. 2
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingManager.cs

2
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingManager.cs

@ -101,10 +101,12 @@ namespace ICSharpCode.AvalonEdit.Folding @@ -101,10 +101,12 @@ namespace ICSharpCode.AvalonEdit.Folding
int pos = textViews.IndexOf(textView);
if (pos < 0)
throw new ArgumentException();
textViews.RemoveAt(pos);
foreach (FoldingSection fs in foldings) {
if (fs.collapsedSections != null) {
var c = new CollapsedLineSection[textViews.Count];
Array.Copy(fs.collapsedSections, 0, c, 0, pos);
fs.collapsedSections[pos].Uncollapse();
Array.Copy(fs.collapsedSections, pos + 1, c, pos, c.Length - pos);
fs.collapsedSections = c;
}

Loading…
Cancel
Save