
I am having the same problem as in this old thread. The syntax editor doesn't outline properly when using a RangeOutliningSourceBase when there are multiple outline ranges with the same end offset.
Code to reproduce the error is below.
using ActiproSoftware.Text.Implementation;
using ActiproSoftware.Windows.Controls.SyntaxEditor.Outlining;
using ActiproSoftware.Windows.Controls.SyntaxEditor.Outlining.Implementation;
using System.Windows;
using ActiproSoftware.Text;
namespace OutliningError
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var doc = new EditorDocument();
doc.SetText("a\n\tb\n\t\tc\nThis text should not be collapseable.\n" +
"Instead the collapse region for 'a' should end just after 'c'");
doc.IsReadOnly = true;
doc.Language = new TrivialLanguage();
uiEditor.Document = doc;
}
}
public class TrivialLanguage : SyntaxLanguage
{
public TrivialLanguage() : base("TrivialLanguage")
{
RegisterService<IOutliner>(new TrivialOutliner());
}
}
public class TrivialOutliningSource : RangeOutliningSourceBase
{
public TrivialOutliningSource(ITextSnapshot snapshot) : base(snapshot)
{
var nodeDef = new OutliningNodeDefinition("nodeDefKey")
{
IsCollapsible = true
};
AddNode(new TextRange(1, 8), nodeDef);
AddNode(new TextRange(4, 8), nodeDef);
}
}
public class TrivialOutliner : IOutliner
{
public AutomaticOutliningUpdateTrigger UpdateTrigger
{
get
{
return AutomaticOutliningUpdateTrigger.TextChanged;
}
}
public IOutliningSource GetOutliningSource(ITextSnapshot snapshot)
{
return new TrivialOutliningSource(snapshot);
}
}
}
<Window x:Class="OutliningError.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:syntaxeditor="http://schemas.actiprosoftware.com/winfx/xaml/syntaxeditor"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<syntaxeditor:SyntaxEditor x:Name="uiEditor"/>
</Grid>
</Window>
Also, sorry to post this all twice. I posted it again here because I thought it may get missed at the end of a 3 year old thread.