From 32a20dcb3deafe30dd71a1764cce22820aa7f2be Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 27 Sep 2020 10:54:09 -0500 Subject: [PATCH] Tastudio Markers - scroll to newly added marker instead of assuming it is the last in the list and scrolling to bottom, fixes #2350 --- .../tools/TAStudio/MarkerControl.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs index f36ed78e62..0b90393729 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs @@ -179,6 +179,7 @@ namespace BizHawk.Client.EmuHawk public void AddMarker(int frame, bool editText = false) { + TasMovieMarker marker; if (editText) { var i = new InputPrompt @@ -196,20 +197,23 @@ namespace BizHawk.Client.EmuHawk point.Offset(i.Width / -2, i.Height / -2); var result = i.ShowHawkDialog(this, position: point); - if (result.IsOk()) + if (!result.IsOk()) { - Markers.Add(new TasMovieMarker(frame, i.PromptText)); - UpdateTextColumnWidth(); - UpdateValues(); + return; } + + UpdateTextColumnWidth(); + marker = new TasMovieMarker(frame, i.PromptText); } else { - Markers.Add(new TasMovieMarker(frame)); - UpdateValues(); + marker = new TasMovieMarker(frame); } - MarkerView.ScrollToIndex(Markers.Count - 1); + UpdateValues(); + Markers.Add(marker); + var index = Markers.IndexOf(marker); + MarkerView.MakeIndexVisible(index); Tastudio.RefreshDialog(); }