From 9899fe5e81849363c13ba7f0707830369561d50b Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 16 Mar 2021 09:51:52 +0100 Subject: [PATCH] Clarify naming. --- src/Avalonia.Controls/TextBox.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.Controls/TextBox.cs b/src/Avalonia.Controls/TextBox.cs index 44d1a1c489..1d75f08a41 100644 --- a/src/Avalonia.Controls/TextBox.cs +++ b/src/Avalonia.Controls/TextBox.cs @@ -528,11 +528,11 @@ namespace Avalonia.Controls string text = Text ?? string.Empty; int caretIndex = CaretIndex; - int estimatedLength = input.Length + text.Length - Math.Abs(SelectionStart - SelectionEnd); + int newLength = input.Length + text.Length - Math.Abs(SelectionStart - SelectionEnd); - if (MaxLength > 0 && estimatedLength > MaxLength) + if (MaxLength > 0 && newLength > MaxLength) { - input = input.Remove(Math.Max(0, input.Length - (estimatedLength - MaxLength))); + input = input.Remove(Math.Max(0, input.Length - (newLength - MaxLength))); } if (!string.IsNullOrEmpty(input))