Skip to content

Commit 1a25590

Browse files
committed
Fix refresh bugs for the undo history form.
1 parent 79d79e7 commit 1a25590

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ public void RemoveFrames(int removeStart, int removeUpTo)
164164
ShiftBindedMarkers(removeUpTo, removeStart - removeUpTo);
165165

166166
Changes = true;
167-
InvalidateAfter(removeStart);
168-
169167
ChangeLog.AddRemoveFrames(
170168
removeStart,
171169
removeUpTo,
172170
removedInputs.ToList(),
173171
removedMarkers,
174172
$"Remove frames {removeStart}-{removeUpTo - 1}"
175173
);
174+
175+
InvalidateAfter(removeStart);
176176
}
177177

178178
public void InsertInput(int frame, string inputState)
@@ -188,9 +188,9 @@ public void InsertInput(int frame, IEnumerable<string> inputLog)
188188
ShiftBindedMarkers(frame, inputLog.Count());
189189

190190
Changes = true;
191-
InvalidateAfter(frame);
192-
193191
ChangeLog.AddInsertInput(frame, inputLog.ToList(), $"Insert {inputLog.Count()} frame(s) at {frame}");
192+
193+
InvalidateAfter(frame);
194194
}
195195

196196
public void InsertInput(int frame, IEnumerable<IController> inputStates)
@@ -258,9 +258,9 @@ public void InsertEmptyFrame(int frame, int count = 1)
258258
ShiftBindedMarkers(frame, count);
259259

260260
Changes = true;
261-
InvalidateAfter(frame);
262-
263261
ChangeLog.AddInsertFrames(frame, count, $"Insert {count} empty frame(s) at {frame}");
262+
263+
InvalidateAfter(frame);
264264
}
265265

266266
private void ExtendMovieForEdit(int numFrames)
@@ -295,12 +295,12 @@ public void ToggleBoolState(int frame, string buttonName)
295295

296296
var adapter = GetInputState(frame);
297297
adapter.SetBool(buttonName, !adapter.IsPressed(buttonName));
298-
299298
Log[frame] = Bk2LogEntryGenerator.GenerateLogEntry(adapter);
300-
Changes = true;
301-
InvalidateAfter(frame);
302299

300+
Changes = true;
303301
ChangeLog.AddBoolToggle(frame, buttonName, !adapter.IsPressed(buttonName), $"Toggle {buttonName}: {frame}");
302+
303+
InvalidateAfter(frame);
304304
}
305305

306306
public void SetBoolState(int frame, string buttonName, bool val)
@@ -318,9 +318,9 @@ public void SetBoolState(int frame, string buttonName, bool val)
318318

319319
if (old != val)
320320
{
321-
InvalidateAfter(frame);
322321
Changes = true;
323322
ChangeLog.AddBoolToggle(frame, buttonName, old, $"Set {buttonName}({(val ? "On" : "Off")}): {frame}");
323+
InvalidateAfter(frame);
324324
}
325325
}
326326

@@ -372,9 +372,9 @@ public void SetAxisState(int frame, string buttonName, int val)
372372

373373
if (old != val)
374374
{
375-
InvalidateAfter(frame);
376375
Changes = true;
377376
ChangeLog.AddAxisChange(frame, buttonName, old, val, $"Set {buttonName}({val}): {frame}");
377+
InvalidateAfter(frame);
378378
}
379379
}
380380

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -874,11 +874,18 @@ public bool FrameEdited(int frame)
874874
RefreshDialog();
875875
return true;
876876
}
877-
else if (TasView.RowCount != CurrentTasMovie.InputLogLength + 1)
877+
else
878878
{
879-
// Row count must always be kept up to date even if last row is not directly visible.
880-
TasView.RowCount = CurrentTasMovie.InputLogLength + 1;
881-
return true;
879+
if (_undoForm != null && !_undoForm.IsDisposed)
880+
{
881+
_undoForm.UpdateValues();
882+
}
883+
if (TasView.RowCount != CurrentTasMovie.InputLogLength + 1)
884+
{
885+
// Row count must always be kept up to date even if last row is not directly visible.
886+
TasView.RowCount = CurrentTasMovie.InputLogLength + 1;
887+
return true;
888+
}
882889
}
883890
}
884891

0 commit comments

Comments
 (0)