diff --git a/src/AvaloniaEdit.TextMate/Compatibility/Math.cs b/src/AvaloniaEdit.TextMate/Compatibility/Math.cs new file mode 100644 index 00000000..073da018 --- /dev/null +++ b/src/AvaloniaEdit.TextMate/Compatibility/Math.cs @@ -0,0 +1,11 @@ +namespace AvaloniaEdit.TextMate.Compatibility +{ + internal static class Math + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + public static int Clamp(int value, int min, int max) + { + return (value < min) ? min : (value > max) ? max : value; + } + } +} diff --git a/src/AvaloniaEdit.TextMate/TextEditorModel.cs b/src/AvaloniaEdit.TextMate/TextEditorModel.cs index 33ed8b65..4d4de8a7 100644 --- a/src/AvaloniaEdit.TextMate/TextEditorModel.cs +++ b/src/AvaloniaEdit.TextMate/TextEditorModel.cs @@ -7,6 +7,12 @@ using TextMateSharp.Model; +#if NET6_0_OR_GREATER +using Math = System.Math; +#else +using Math = AvaloniaEdit.TextMate.Compatibility.Math; +#endif + namespace AvaloniaEdit.TextMate { public class TextEditorModel : AbstractLineList, IDisposable