Skip to content

Commit 33e7058

Browse files
committed
Include undo history form refreshing with TAStudio's refresh logic. Fix a bug that could cause an invalid scroll in undo history form.
1 parent 9164f1d commit 33e7058

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

src/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ public interface IMovieChangeLog
88
{
99
List<string> Names { get; }
1010
int UndoIndex { get; }
11-
string NextUndoStepName { get; }
1211
/// <summary>
1312
/// Gets or sets a value indicating whether the movie is recording action history.
1413
/// This is not intended to turn off the ChangeLog, but to disable the normal recording process.
@@ -226,19 +225,6 @@ public void Redo()
226225
public bool CanUndo => UndoIndex > -1;
227226
public bool CanRedo => UndoIndex < _history.Count - 1;
228227

229-
public string NextUndoStepName
230-
{
231-
get
232-
{
233-
if (Names.Count == 0 || UndoIndex < 0)
234-
{
235-
return null;
236-
}
237-
238-
return Names[UndoIndex];
239-
}
240-
}
241-
242228
private void AddMovieAction(string name)
243229
{
244230
if (UndoIndex + 1 != _history.Count)

src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -852,11 +852,18 @@ public bool FrameEdited(int frame)
852852
RefreshDialog();
853853
return true;
854854
}
855-
else if (TasView.RowCount != CurrentTasMovie.InputLogLength + 1)
855+
else
856856
{
857-
// Row count must always be kept up to date even if last row is not directly visible.
858-
TasView.RowCount = CurrentTasMovie.InputLogLength + 1;
859-
return true;
857+
if (_undoForm != null && !_undoForm.IsDisposed)
858+
{
859+
_undoForm.UpdateValues();
860+
}
861+
if (TasView.RowCount != CurrentTasMovie.InputLogLength + 1)
862+
{
863+
// Row count must always be kept up to date even if last row is not directly visible.
864+
TasView.RowCount = CurrentTasMovie.InputLogLength + 1;
865+
return true;
866+
}
860867
}
861868
}
862869

src/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public partial class UndoHistoryForm : Form
1010
private const string UndoColumnName = "Undo Step";
1111

1212
private readonly TAStudio _tastudio;
13-
private string _lastUndoAction;
13+
private int _lastUndoAction;
1414
private IMovieChangeLog Log => _tastudio.CurrentTasMovie.ChangeLog;
1515

1616
public UndoHistoryForm(TAStudio owner)
@@ -50,14 +50,14 @@ private void HistoryView_QueryItemBkColor(int index, RollColumn column, ref Colo
5050
public void UpdateValues()
5151
{
5252
HistoryView.RowCount = Log.Names.Count;
53-
if (AutoScrollCheck.Checked && _lastUndoAction != Log.NextUndoStepName)
53+
if (AutoScrollCheck.Checked && _lastUndoAction != Log.UndoIndex)
5454
{
55-
HistoryView.ScrollToIndex(Log.UndoIndex);
55+
HistoryView.ScrollToIndex(Math.Max(Log.UndoIndex, 0));
5656
HistoryView.DeselectAll();
5757
HistoryView.SelectRow(Log.UndoIndex - 1, true);
5858
}
5959

60-
_lastUndoAction = Log.NextUndoStepName;
60+
_lastUndoAction = Log.UndoIndex;
6161

6262
HistoryView.Refresh();
6363
}

0 commit comments

Comments
 (0)