diff --git a/Luski/GUI/MainScreen/UI/LuskiControls/TextBox.cs b/Luski/GUI/MainScreen/UI/LuskiControls/TextBox.cs index f4083e3..0fb71c8 100644 --- a/Luski/GUI/MainScreen/UI/LuskiControls/TextBox.cs +++ b/Luski/GUI/MainScreen/UI/LuskiControls/TextBox.cs @@ -236,6 +236,13 @@ public class TextBox : UserControl _label.Location = _label.Location; } } + + if (_label.Text.Length < CursorLocation) + { + CursorLocation = _label.Text.Length; + var xy = _label.GetCharLocation(CursorLocation); + Pointer.Location = new(_label.Location.X + xy.X, _label.Location.Y + xy.Y, Pointer.Location.Z); + } } } public string WatermarkText @@ -283,8 +290,8 @@ public class TextBox : UserControl Size = new(Size.X, Size.Y - (int)_label.Font.PixelHeight); if (OnRemoveLine is not null) OnRemoveLine.Invoke(); } - Text = Text.Remove(CursorLocation - 1, 1); CursorLocation--; + Text = Text.Remove(CursorLocation, 1); var f = _label.GetCharLocation(CursorLocation); Pointer.Location = _label.Location + new Vector3i(f.X, f.Y, 0); Pointer.Visible = true;