From 2626608a2de4d585a493eef11163ca7a3daffaf5 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Wed, 28 Jul 2021 15:07:16 +0800 Subject: [PATCH] fix ghost moving when pointer is the last node --- BallanceTASEditor/UI/TASViewer.cs | 6 ++---- BallanceTASEditorTests/Core/TASFileTests.cs | 7 +++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/BallanceTASEditor/UI/TASViewer.cs b/BallanceTASEditor/UI/TASViewer.cs index 7fa4f19..73eaf17 100644 --- a/BallanceTASEditor/UI/TASViewer.cs +++ b/BallanceTASEditor/UI/TASViewer.cs @@ -71,10 +71,8 @@ namespace BallanceTASEditor.UI { } private void updateSliderRange() { - long newSize = mFile.mFrameCount - 1; - if (mSlider.Value > newSize) - mSlider.Value = newSize; - mSlider.Maximum = newSize; + mSlider.Maximum = mFile.mFrameCount - 1; + mSlider.Value = mFile.GetPointerIndex(); } private void funcSelectionHelp_SelectionChanged() { diff --git a/BallanceTASEditorTests/Core/TASFileTests.cs b/BallanceTASEditorTests/Core/TASFileTests.cs index fde5883..8579e3a 100644 --- a/BallanceTASEditorTests/Core/TASFileTests.cs +++ b/BallanceTASEditorTests/Core/TASFileTests.cs @@ -126,6 +126,13 @@ namespace BallanceTASEditor.Core.Tests { [DataRow("1,2,3,4,5", 2, "4;4;6,7,8,9,4,5,", 2, "6,7,8,9", true, true)] [DataRow("1,2,3,4,5", 2, "2;1;1,2,6,7,8,9,", 2, "6,7,8,9", false, true)] + [DataRow("1,2,3,4,5", 4, "5;4;1,6,7,4,5,", 2, "6,7", true, true)] + [DataRow("1,2,3,4,5", 4, "5;4;1,2,6,7,5,", 2, "6,7", false, true)] + [DataRow("1,2,3,4,5", 4, "5;4;6,7,8,4,5,", 2, "6,7,8", true, true)] + [DataRow("1,2,3,4,5", 4, "2;1;1,2,6,7,8,", 2, "6,7,8", false, true)] + [DataRow("1,2,3,4,5", 4, "5;5;6,7,8,9,4,5,", 2, "6,7,8,9", true, true)] + [DataRow("1,2,3,4,5", 4, "2;1;1,2,6,7,8,9,", 2, "6,7,8,9", false, true)] + [DataRow("1,2,3,4,5", 2, "3;5;1,2,6,7,8,3,4,5,", 2, "6,7,8", true, false)] [DataRow("1,2,3,4,5", 2, "3;2;1,2,3,6,7,8,4,5,", 2, "6,7,8", false, false)] public void InsertTest(string originStr, long prevShift, string expectedStr, long absolutePos, string insertedData, bool isInsertBefore, bool isOverwritten) {