@ -73,11 +73,20 @@ namespace ICSharpCode.AvalonEdit.Folding
@@ -73,11 +73,20 @@ namespace ICSharpCode.AvalonEdit.Folding
/// <inheritdoc/>
public override int GetFirstInterestedOffset ( int startOffset )
{
if ( foldingManager ! = null )
if ( foldingManager ! = null ) {
foreach ( FoldingSection fs in foldingManager . GetFoldingsContaining ( startOffset ) ) {
// Test whether we're currently within a folded folding (that didn't just end).
// If so, create the fold marker immediately.
// This is necessary if the actual beginning of the fold marker got skipped due to another VisualElementGenerator.
if ( fs . IsFolded & & fs . EndOffset > startOffset ) {
//return startOffset;
}
}
return foldingManager . GetNextFoldedFoldingStart ( startOffset ) ;
else
} else {
return - 1 ;
}
}
/// <inheritdoc/>
public override VisualLineElement ConstructElement ( int offset )
@ -86,7 +95,7 @@ namespace ICSharpCode.AvalonEdit.Folding
@@ -86,7 +95,7 @@ namespace ICSharpCode.AvalonEdit.Folding
return null ;
int foldedUntil = - 1 ;
FoldingSection foldingSection = null ;
foreach ( FoldingSection fs in foldingManager . GetFoldingsAt ( offset ) ) {
foreach ( FoldingSection fs in foldingManager . GetFoldingsContaining ( offset ) ) {
if ( fs . IsFolded ) {
if ( fs . EndOffset > foldedUntil ) {
foldedUntil = fs . EndOffset ;