Skip to content

Commit

Permalink
Merge pull request #32 from danwalmsley/updateavalonia
Browse files Browse the repository at this point in the history
Updates and Fixes in preparation for coming avalonia updates
  • Loading branch information
danwalmsley authored Jun 29, 2017
2 parents 1318f3f + 1058fd9 commit 004f54d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/////////////////////////////////////////////////////////////////////

#addin "nuget:?package=Polly&version=5.0.6"
#addin "nuget:?package=NuGet.Core&version=2.12.0"
#addin "nuget:?package=NuGet.Core&version=2.14.0"

//////////////////////////////////////////////////////////////////////
// TOOLS
Expand Down
2 changes: 1 addition & 1 deletion src/AvaloniaEdit/AvaloniaEdit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<PackageReference Include="System.Collections.Immutable" Version="1.3.1" />
<PackageReference Include="System.ValueTuple" Version="4.3.0" />
<PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" />
<PackageReference Include="Avalonia" Version="0.5.0" />
<PackageReference Include="Avalonia" Version="0.5.1-build3330-alpha" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/AvaloniaEdit/Editing/TextArea.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />-->
<Setter Property="Template">
<ControlTemplate>
<DockPanel Focusable="False">
<DockPanel Focusable="False" Background="{TemplateBinding Background}">
<ItemsControl DockPanel.Dock="Left"
Focusable="False"
Items="{TemplateBinding LeftMargins}">
Expand All @@ -23,7 +23,7 @@
</ItemsControl.ItemsPanel>
</ItemsControl>
<ContentPresenter Name="PART_CP" Cursor="IBeam"
Focusable="False" />
Focusable="False" Background="{TemplateBinding Background}" />
</DockPanel>
</ControlTemplate>
</Setter>
Expand Down
11 changes: 8 additions & 3 deletions src/AvaloniaEdit/Rendering/TextView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -706,14 +706,15 @@ public void Redraw(ISegment segment, DispatcherPriority redrawPriority = Dispatc
/// </summary>
private void ClearVisualLines()
{
_visibleVisualLines = null;
if (_allVisualLines.Count != 0)
{
foreach (var visualLine in _allVisualLines)
{
DisposeVisualLine(visualLine);
}
_allVisualLines.Clear();

_visibleVisualLines = new ReadOnlyCollection<VisualLine>(_allVisualLines);
}
}

Expand All @@ -723,8 +724,7 @@ private void DisposeVisualLine(VisualLine visualLine)
{
throw new ArgumentException("Cannot dispose visual line because it is in construction!");
}

_visibleVisualLines = null;

visualLine.Dispose();
RemoveInlineObjects(visualLine);
}
Expand Down Expand Up @@ -1256,6 +1256,11 @@ private void BackgroundRenderer_Removed(IBackgroundRenderer renderer)
/// <inheritdoc/>
public override void Render(DrawingContext drawingContext)
{
if(!VisualLinesValid)
{
return;
}

RenderBackground(drawingContext, KnownLayer.Background);
foreach (var line in _visibleVisualLines)
{
Expand Down
2 changes: 2 additions & 0 deletions src/AvaloniaEdit/TextEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ protected TextEditor(TextArea textArea)

SetValue(OptionsProperty, textArea.Options);
SetValue(DocumentProperty, new TextDocument());

textArea[!BackgroundProperty] = this[!BackgroundProperty];
}

#endregion
Expand Down
11 changes: 1 addition & 10 deletions src/AvaloniaEdit/TextEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<Style Selector="AvalonEdit|TextEditor">
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer Focusable="False"
Name="PART_ScrollViewer"
Expand All @@ -15,14 +14,6 @@
HorizontalContentAlignment="Left"
Padding="{TemplateBinding Padding}" />
</Border>
<!--<ControlTemplate.Triggers>
<Trigger Property="WordWrap"
Value="True">
<Setter TargetName="PART_ScrollViewer"
Property="HorizontalScrollBarVisibility"
Value="Disabled" />
</Trigger>
</ControlTemplate.Triggers>-->
</ControlTemplate>
</Setter>
</Style>
Expand Down

0 comments on commit 004f54d

Please sign in to comment.