diff --git a/Directory.Build.props b/Directory.Build.props
index a6d26161..6f2ded36 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -2,8 +2,8 @@
latest
true
- 11.0.0-preview6
- 1.0.52
+ 11.0.0-preview8
+ 1.0.55
beta
diff --git a/src/AvaloniaEdit.TextMate/TextEditorModel.cs b/src/AvaloniaEdit.TextMate/TextEditorModel.cs
index 1583ae3d..641919e1 100644
--- a/src/AvaloniaEdit.TextMate/TextEditorModel.cs
+++ b/src/AvaloniaEdit.TextMate/TextEditorModel.cs
@@ -187,7 +187,7 @@ private void TokenizeViewPort()
ForceTokenization(
_textView.VisualLines[0].FirstDocumentLine.LineNumber - 1,
_textView.VisualLines[_textView.VisualLines.Count - 1].LastDocumentLine.LineNumber - 1);
- }, DispatcherPriority.MinValue);
+ }, DispatcherPriority.Default);
}
internal class InvalidLineRange
diff --git a/src/AvaloniaEdit/Editing/EditingCommandHandler.cs b/src/AvaloniaEdit/Editing/EditingCommandHandler.cs
index e77c611b..277ba070 100644
--- a/src/AvaloniaEdit/Editing/EditingCommandHandler.cs
+++ b/src/AvaloniaEdit/Editing/EditingCommandHandler.cs
@@ -24,6 +24,7 @@
using AvaloniaEdit.Document;
using Avalonia.Input;
using AvaloniaEdit.Utils;
+using Avalonia.Controls;
namespace AvaloniaEdit.Editing
{
@@ -415,17 +416,17 @@ private static bool CopySelectedText(TextArea textArea)
var text = textArea.Selection.GetText();
text = TextUtilities.NormalizeNewLines(text, Environment.NewLine);
- SetClipboardText(text);
+ SetClipboardText(text, textArea);
textArea.OnTextCopied(new TextEventArgs(text));
return true;
}
- private static void SetClipboardText(string text)
+ private static void SetClipboardText(string text, Visual visual)
{
try
{
- Application.Current.Clipboard.SetTextAsync(text).GetAwaiter().GetResult();
+ TopLevel.GetTopLevel(visual)?.Clipboard?.SetTextAsync(text).GetAwaiter().GetResult();
}
catch (Exception)
{
@@ -470,7 +471,7 @@ private static bool CopyWholeLine(TextArea textArea, DocumentLine line)
//if (copyingEventArgs.CommandCancelled)
// return false;
- SetClipboardText(text);
+ SetClipboardText(text, textArea);
textArea.OnTextCopied(new TextEventArgs(text));
return true;
@@ -496,7 +497,7 @@ private static async void OnPaste(object target, ExecutedRoutedEventArgs args)
string text = null;
try
{
- text = await Application.Current.Clipboard.GetTextAsync();
+ text = await TopLevel.GetTopLevel(textArea)?.Clipboard?.GetTextAsync();
}
catch (Exception)
{
diff --git a/src/AvaloniaEdit/Editing/TextArea.xaml b/src/AvaloniaEdit/Editing/TextArea.xaml
index 62e747c0..43488055 100644
--- a/src/AvaloniaEdit/Editing/TextArea.xaml
+++ b/src/AvaloniaEdit/Editing/TextArea.xaml
@@ -15,7 +15,7 @@
+ ItemsSource="{TemplateBinding LeftMargins}">
diff --git a/test/AvaloniaEdit.Tests/AvaloniaEdit.Tests.csproj b/test/AvaloniaEdit.Tests/AvaloniaEdit.Tests.csproj
index 1d5d78ca..b7b4234e 100644
--- a/test/AvaloniaEdit.Tests/AvaloniaEdit.Tests.csproj
+++ b/test/AvaloniaEdit.Tests/AvaloniaEdit.Tests.csproj
@@ -5,13 +5,14 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/test/AvaloniaEdit.Tests/AvaloniaMocks/MockFontManagerImpl.cs b/test/AvaloniaEdit.Tests/AvaloniaMocks/MockFontManagerImpl.cs
deleted file mode 100644
index deae986e..00000000
--- a/test/AvaloniaEdit.Tests/AvaloniaMocks/MockFontManagerImpl.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using Avalonia.Media;
-using Avalonia.Platform;
-
-using Moq;
-
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-
-#nullable enable
-
-namespace AvaloniaEdit.AvaloniaMocks
-{
- public class MockFontManagerImpl : IFontManagerImpl
- {
- private readonly string _defaultFamilyName;
-
- public MockFontManagerImpl(string defaultFamilyName = "Default")
- {
- _defaultFamilyName = defaultFamilyName;
- }
-
- public string GetDefaultFontFamilyName()
- {
- return _defaultFamilyName;
- }
-
- public string[] GetInstalledFontFamilyNames(bool checkForUpdates = false)
- {
- return new[] { _defaultFamilyName };
- }
-
- public bool TryMatchCharacter(int codepoint, FontStyle fontStyle, FontWeight fontWeight, FontStretch fontStretch,
- FontFamily? fontFamily, CultureInfo? culture, out Typeface typeface)
- {
- typeface = new Typeface(_defaultFamilyName);
-
- return true;
- }
-
- public bool TryCreateGlyphTypeface(string familyName, FontStyle style, FontWeight weight,
- FontStretch stretch, out IGlyphTypeface glyphTypeface)
- {
- glyphTypeface = new MockGlyphTypeface();
- return true;
- }
-
- public bool TryCreateGlyphTypeface(Stream stream, out IGlyphTypeface glyphTypeface)
- {
- glyphTypeface = new MockGlyphTypeface();
- return true;
- }
- }
-}
diff --git a/test/AvaloniaEdit.Tests/AvaloniaMocks/MockGlyphRun.cs b/test/AvaloniaEdit.Tests/AvaloniaMocks/MockGlyphRun.cs
deleted file mode 100644
index 377c6e31..00000000
--- a/test/AvaloniaEdit.Tests/AvaloniaMocks/MockGlyphRun.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using Avalonia;
-using Avalonia.Media.TextFormatting;
-using Avalonia.Platform;
-using System.Collections.Generic;
-
-namespace AvaloniaEdit.AvaloniaMocks
-{
- internal class MockGlyphRun : IGlyphRunImpl
- {
- public MockGlyphRun(IReadOnlyList glyphInfos)
- {
- var width = 0.0;
-
- for (var i = 0; i < glyphInfos.Count; ++i)
- {
- width += glyphInfos[i].GlyphAdvance;
- }
-
- Bounds = new Rect(new Size(width, 10));
- }
-
- public Rect Bounds { get; }
-
- public Point BaselineOrigin => new Point(0, 8);
-
- public void Dispose()
- {
-
- }
-
- public IReadOnlyList GetIntersections(float lowerBound, float upperBound)
- {
- return null;
- }
- }
-}
diff --git a/test/AvaloniaEdit.Tests/AvaloniaMocks/MockGlyphTypeface.cs b/test/AvaloniaEdit.Tests/AvaloniaMocks/MockGlyphTypeface.cs
deleted file mode 100644
index 279aed08..00000000
--- a/test/AvaloniaEdit.Tests/AvaloniaMocks/MockGlyphTypeface.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-using Avalonia.Media;
-
-using System;
-
-namespace AvaloniaEdit.AvaloniaMocks
-{
- public class MockGlyphTypeface : IGlyphTypeface
- {
- public FontMetrics Metrics => new FontMetrics
- {
- DesignEmHeight = 10,
- Ascent = 2,
- Descent = 10,
- IsFixedPitch = true
- };
-
- public FontStretch Stretch { get; }
- public int GlyphCount => 1337;
-
- public FontSimulations FontSimulations => throw new NotImplementedException();
-
- public ushort GetGlyph(uint codepoint)
- {
- return (ushort)codepoint;
- }
-
- public ushort[] GetGlyphs(ReadOnlySpan codepoints)
- {
- return new ushort[codepoints.Length];
- }
-
- public int GetGlyphAdvance(ushort glyph)
- {
- return 8;
- }
-
- public bool TryGetGlyph(uint codepoint, out ushort glyph)
- {
- glyph = 8;
-
- return true;
- }
-
- public static int GlyphAdvance => 8;
-
- public int[] GetGlyphAdvances(ReadOnlySpan glyphs)
- {
- var advances = new int[glyphs.Length];
-
- for (var i = 0; i < advances.Length; i++)
- {
- advances[i] = GlyphAdvance;
- }
-
- return advances;
- }
-
- public void Dispose() { }
-
- public bool TryGetTable(uint tag, out byte[] table)
- {
- table = null;
- return false;
- }
-
- public string FamilyName => "";
- public FontWeight Weight => FontWeight.Normal;
- public FontStyle Style => FontStyle.Normal;
-
- public bool TryGetGlyphMetrics(ushort glyph, out GlyphMetrics metrics)
- {
- metrics = new GlyphMetrics
- {
- Width = 10,
- Height = 10
- };
-
- return true;
- }
- }
-}
diff --git a/test/AvaloniaEdit.Tests/AvaloniaMocks/MockPlatformHotkeyConfiguration.cs b/test/AvaloniaEdit.Tests/AvaloniaMocks/MockPlatformHotkeyConfiguration.cs
deleted file mode 100644
index 31f78549..00000000
--- a/test/AvaloniaEdit.Tests/AvaloniaMocks/MockPlatformHotkeyConfiguration.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using Avalonia.Input.Platform;
-
-namespace AvaloniaEdit.AvaloniaMocks
-{
- public class MockPlatformHotkeyConfiguration : PlatformHotkeyConfiguration
- {
- public MockPlatformHotkeyConfiguration() : base(Avalonia.Input.KeyModifiers.Control)
- {
-
- }
-
- }
-}
diff --git a/test/AvaloniaEdit.Tests/AvaloniaMocks/MockPlatformRenderInterface.cs b/test/AvaloniaEdit.Tests/AvaloniaMocks/MockPlatformRenderInterface.cs
deleted file mode 100644
index 1da9463d..00000000
--- a/test/AvaloniaEdit.Tests/AvaloniaMocks/MockPlatformRenderInterface.cs
+++ /dev/null
@@ -1,162 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using Avalonia;
-using Avalonia.Media;
-using Avalonia.Media.Imaging;
-using Avalonia.Media.TextFormatting;
-using Avalonia.Platform;
-using Moq;
-
-namespace AvaloniaEdit.AvaloniaMocks
-{
- public class MockPlatformRenderInterface : IPlatformRenderInterface
- {
- public IEnumerable InstalledFontNames => throw new NotImplementedException();
-
- public bool SupportsIndividualRoundRects => throw new NotImplementedException();
-
- public AlphaFormat DefaultAlphaFormat => throw new NotImplementedException();
-
- public PixelFormat DefaultPixelFormat => throw new NotImplementedException();
-
- public IGeometryImpl CreateEllipseGeometry(Rect rect)
- {
- throw new NotImplementedException();
- }
-
- public IGeometryImpl CreateLineGeometry(Point p1, Point p2)
- {
- throw new NotImplementedException();
- }
-
- public IGeometryImpl CreateRectangleGeometry(Rect rect)
- {
- throw new NotImplementedException();
- }
-
- public IRenderTarget CreateRenderTarget(IEnumerable