From 4e08e8ffecde0a43b0e94218425c94d63b42ae99 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Sat, 25 Feb 2023 00:20:38 +0800 Subject: [PATCH] fix: fix a deletion issue. --- src/Ursa/Controls/IPv4Box.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ursa/Controls/IPv4Box.cs b/src/Ursa/Controls/IPv4Box.cs index 30bcbf5..e8e6b92 100644 --- a/src/Ursa/Controls/IPv4Box.cs +++ b/src/Ursa/Controls/IPv4Box.cs @@ -440,7 +440,7 @@ public class IPv4Box: TemplatedControl { int index = presenter.CaretIndex; if (index == 0) return; - string newText = oldText?.Substring(0, index - 1) + oldText?.Substring(index); + string newText = oldText?.Substring(0, index - 1) + oldText?.Substring(Math.Min(index, oldText.Length)); presenter.MoveCaretHorizontal(LogicalDirection.Backward); presenter.Text = newText; }