From a73244e9c75ccdb59f382bd6e0bc11a86b720c4f Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 27 Jun 2017 13:30:36 +0100 Subject: [PATCH 1/6] update avalonia. --- src/AvaloniaEdit/AvaloniaEdit.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AvaloniaEdit/AvaloniaEdit.csproj b/src/AvaloniaEdit/AvaloniaEdit.csproj index b6d9a639..e8ae8403 100644 --- a/src/AvaloniaEdit/AvaloniaEdit.csproj +++ b/src/AvaloniaEdit/AvaloniaEdit.csproj @@ -38,7 +38,7 @@ - + \ No newline at end of file From 3dbece3df0b093dafc44bd5717b3932e81a4dca0 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 29 Jun 2017 12:36:58 +0100 Subject: [PATCH 2/6] prepare for upcoming scenegraph upgrade in avalonia bind background of text area (required or mouse clicks wont be caught) dont render if visual lines are not valid. --- src/AvaloniaEdit/AvaloniaEdit.csproj | 2 +- src/AvaloniaEdit/Editing/TextArea.xaml | 4 ++-- src/AvaloniaEdit/Rendering/TextView.cs | 5 +++++ src/AvaloniaEdit/TextEditor.cs | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/AvaloniaEdit/AvaloniaEdit.csproj b/src/AvaloniaEdit/AvaloniaEdit.csproj index e8ae8403..d533c644 100644 --- a/src/AvaloniaEdit/AvaloniaEdit.csproj +++ b/src/AvaloniaEdit/AvaloniaEdit.csproj @@ -38,7 +38,7 @@ - + \ No newline at end of file diff --git a/src/AvaloniaEdit/Editing/TextArea.xaml b/src/AvaloniaEdit/Editing/TextArea.xaml index 7188f73f..62e747c0 100644 --- a/src/AvaloniaEdit/Editing/TextArea.xaml +++ b/src/AvaloniaEdit/Editing/TextArea.xaml @@ -12,7 +12,7 @@ Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />--> - + @@ -23,7 +23,7 @@ + Focusable="False" Background="{TemplateBinding Background}" /> diff --git a/src/AvaloniaEdit/Rendering/TextView.cs b/src/AvaloniaEdit/Rendering/TextView.cs index 552a087e..48849401 100644 --- a/src/AvaloniaEdit/Rendering/TextView.cs +++ b/src/AvaloniaEdit/Rendering/TextView.cs @@ -1256,6 +1256,11 @@ private void BackgroundRenderer_Removed(IBackgroundRenderer renderer) /// public override void Render(DrawingContext drawingContext) { + if(!VisualLinesValid) + { + return; + } + RenderBackground(drawingContext, KnownLayer.Background); foreach (var line in _visibleVisualLines) { diff --git a/src/AvaloniaEdit/TextEditor.cs b/src/AvaloniaEdit/TextEditor.cs index 45bb4930..9dd52cb1 100644 --- a/src/AvaloniaEdit/TextEditor.cs +++ b/src/AvaloniaEdit/TextEditor.cs @@ -75,6 +75,8 @@ protected TextEditor(TextArea textArea) SetValue(OptionsProperty, textArea.Options); SetValue(DocumentProperty, new TextDocument()); + + textArea[!BackgroundProperty] = this[!BackgroundProperty]; } #endregion From dc54dd22018f22bf9db5649eed96e8bdb179c1e0 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 29 Jun 2017 12:38:18 +0100 Subject: [PATCH 3/6] remove redundant code. --- src/AvaloniaEdit/TextEditor.xaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/AvaloniaEdit/TextEditor.xaml b/src/AvaloniaEdit/TextEditor.xaml index 82277470..61672cfe 100644 --- a/src/AvaloniaEdit/TextEditor.xaml +++ b/src/AvaloniaEdit/TextEditor.xaml @@ -15,14 +15,6 @@ HorizontalContentAlignment="Left" Padding="{TemplateBinding Padding}" /> - From 92885a18cec05101633371bef3d905eeb4f5a394 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 29 Jun 2017 12:54:48 +0100 Subject: [PATCH 4/6] fix crashing whereby we can reach render loop when visual lines is not valid. --- src/AvaloniaEdit/Rendering/TextView.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/AvaloniaEdit/Rendering/TextView.cs b/src/AvaloniaEdit/Rendering/TextView.cs index 48849401..0b1ae2aa 100644 --- a/src/AvaloniaEdit/Rendering/TextView.cs +++ b/src/AvaloniaEdit/Rendering/TextView.cs @@ -706,7 +706,6 @@ public void Redraw(ISegment segment, DispatcherPriority redrawPriority = Dispatc /// private void ClearVisualLines() { - _visibleVisualLines = null; if (_allVisualLines.Count != 0) { foreach (var visualLine in _allVisualLines) @@ -714,6 +713,8 @@ private void ClearVisualLines() DisposeVisualLine(visualLine); } _allVisualLines.Clear(); + + _visibleVisualLines = new ReadOnlyCollection(_allVisualLines); } } @@ -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); } From 7b1c765dc2c12d7474c002a4bcce298040397647 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 29 Jun 2017 13:00:09 +0100 Subject: [PATCH 5/6] background no longer set in xaml via border, bound in code. --- src/AvaloniaEdit/TextEditor.xaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/AvaloniaEdit/TextEditor.xaml b/src/AvaloniaEdit/TextEditor.xaml index 61672cfe..afaa4f42 100644 --- a/src/AvaloniaEdit/TextEditor.xaml +++ b/src/AvaloniaEdit/TextEditor.xaml @@ -4,8 +4,7 @@