From 72efe5597061c94de754f4a22480c6b705b4d71e Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 11 Aug 2019 14:18:07 +0200 Subject: [PATCH] fixed text fields sometimes not updating their length correctly --- MLEM.Ui/Elements/TextField.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MLEM.Ui/Elements/TextField.cs b/MLEM.Ui/Elements/TextField.cs index 8149a67..449283e 100644 --- a/MLEM.Ui/Elements/TextField.cs +++ b/MLEM.Ui/Elements/TextField.cs @@ -43,7 +43,7 @@ namespace MLEM.Ui.Elements { var length = this.font.MeasureString(this.Text).X * this.TextScale; var maxWidth = this.DisplayArea.Width - this.TextOffsetX * 2; if (length > maxWidth) { - for (var i = Math.Max(0, this.textStartIndex - 1); i < this.Text.Length; i++) { + for (var i = 0; i < this.Text.Length; i++) { var substring = this.Text.ToString(i, this.Text.Length - i); if (this.font.MeasureString(substring).X * this.TextScale <= maxWidth) { this.textStartIndex = i;