浏览代码

Clarify naming.

Steven Kirk 4 年之前
父节点
当前提交
9899fe5e81
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/Avalonia.Controls/TextBox.cs

+ 3 - 3
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))