Skip to content

Commit

Permalink
fix: netstandard 2.0 issue, missing Clamp function
Browse files Browse the repository at this point in the history
  • Loading branch information
workgroupengineering committed Jul 29, 2024
1 parent c9cb93c commit b434d28
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/AvaloniaEdit.TextMate/Compatibility/Math.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
6 changes: 6 additions & 0 deletions src/AvaloniaEdit.TextMate/TextEditorModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b434d28

Please sign in to comment.