1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-13 19:54:15 +08:00

Restore editor mode when changing difficulty (#37671)

When editing metadata, it's annoying that the editor returns to compose
mode when switching between difficulties. This fixes that fallacy.

Supersedes and closes https://github.com/ppy/osu/pull/36724.
This commit is contained in:
Dean Herbert
2026-05-08 17:25:22 +09:00
committed by GitHub
Unverified
parent 7d93c242b7
commit e6fdd37e76
3 changed files with 28 additions and 0 deletions
@@ -114,6 +114,27 @@ namespace osu.Game.Tests.Visual.Navigation
&& songSelect.Beatmap.Value is DummyWorkingBeatmap);
}
[Test]
public void TestEditorRestoresModeOnReload()
{
prepareBeatmap();
openEditor();
makeMetadataChange(commit: false);
Editor editor1 = null!;
AddStep("store current editor", () => editor1 = getEditor());
AddStep("reload", () => getEditor().SwitchToDifficulty(getEditorBeatmap().BeatmapInfo));
AddUntilStep("save dialog displayed", () => Game.ChildrenOfType<DialogOverlay>().SingleOrDefault()?.CurrentDialog is PromptForSaveDialog);
AddStep("confirm", () => InputManager.Key(Key.Number1));
AddUntilStep("wait for editor open", () => Game.ScreenStack.CurrentScreen is Editor editor && editor.ReadyForUse);
AddAssert("editor is new instance", () => getEditor() != editor1);
AddAssert("mode is still song setup", () => getEditor().Mode.Value == EditorScreenMode.SongSetup);
}
[Test]
public void TestChangeMetadataExitWhileTextboxFocusedPromptsSave()
{
+2
View File
@@ -513,6 +513,7 @@ namespace osu.Game.Screens.Edit
/// </param>
public EditorState GetState([CanBeNull] RulesetInfo nextRuleset = null) => new EditorState
{
Mode = Mode.Value,
Time = clock.CurrentTimeAccurate,
ClipboardContent = nextRuleset == null || editorBeatmap.BeatmapInfo.Ruleset.ShortName == nextRuleset.ShortName ? Clipboard.Content.Value : string.Empty
};
@@ -523,6 +524,7 @@ namespace osu.Game.Screens.Edit
/// <param name="state">The state to restore.</param>
public void RestoreState([NotNull] EditorState state) => Schedule(() =>
{
Mode.Value = state.Mode;
clock.Seek(state.Time);
Clipboard.Content.Value = state.ClipboardContent;
});
+5
View File
@@ -8,6 +8,11 @@ namespace osu.Game.Screens.Edit
/// </summary>
public class EditorState
{
/// <summary>
/// The current editor mode.
/// </summary>
public EditorScreenMode Mode { get; set; }
/// <summary>
/// The current audio time.
/// </summary>