[PR #234] [MERGED] Horizon menus: delete singleplayer worlds #2422

Closed
opened 2026-11-02 15:55:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/234
Author: @ludovic111
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @ludovic111

Base: main ← Head: fix/horizon-menus-delete-world


📝 Commits (1)

  • 4d7ca0f Horizon menus: delete singleplayer worlds

📊 Changes

5 files changed (+349 additions, -47 deletions)

View changed files

📝 crates/horizon-client/src/front.rs (+247 -36)
📝 crates/horizon-client/src/game.rs (+4 -0)
📝 crates/horizon-client/src/title.rs (+26 -10)
📝 crates/horizon-client/src/title/tests.rs (+28 -0)
📝 crates/horizon-client/src/title/world_management.rs (+44 -1)

📄 Description

What

The Horizon-style Singleplayer page can now delete worlds. Select a world and a Delete (danger) button shows beside Play. It opens a confirmation page in the design language: "Delete this world?", "It will be lost forever. This can't be undone." (vanilla's selectWorld.deleteQuestion/deleteWarning), and a notice led by the danger dot with the world's name, its last-played date and its folder. Then Delete world (danger) and Cancel (ghost). After a delete the list refreshes and the selection moves to the world that took the deleted row, or to the new last world, or to nothing if the list is empty. If a delete fails, a Horizon error page shows, and its Back button returns to the question.

Why

Ludovic: "make it so we can delete the saves we have of worlds". Classic menus already had this (#177). The Horizon menus only had Delete for servers.

How

  • world_management::delete is shared by both menu styles and ports LevelStorageAccess.deleteLevel. It takes the world's session.lock first, so a world open in this or another instance is refused. It deletes everything but the lock, retrying up to 5 times 500 ms apart, then releases and removes the lock and the folder. It only accepts a single plain folder name directly inside saves, and it removes links inside the world without following them.
  • Title::confirm_delete is the common confirm step. The Classic Delete/Cancel buttons now go through it and escape.
  • close_world now flushes the region writer and releases the session lock, as vanilla closes the storage access. Before this, the lock was held until the next world opened, so the world you just left could not be deleted.
  • Edit and Backup are still on the classic screens (unchanged), and so are their errors.

How tested

  • New unit tests: front::tests::horizon_world_delete_confirms_and_keeps_the_selection_in_place (button only shows with a selection; Cancel keeps the world; selection after deleting a middle row and the last row; a locked world shows the Horizon error page and Back returns to the question) and title::tests::delete_refuses_an_open_world_then_removes_it_with_its_lock, delete_removes_links_without_following_them.
  • Mac mini: cargo clippy --workspace --all-targets -D warnings clean. cargo test -p horizon-client --lib title:: front:: save::tests::session gives 21 passed. rustfmt applied.
  • Not done: vscreen screenshots of the new page (stopped by the budget cut). A Linux client build from this branch plus #cursor compiled fine on the ThinkPad.

Follow-up (not built)

Edit (rename / icon / open folder) and Backup have no Horizon pages yet: they still open the classic screens from the Classic world list. The Horizon Singleplayer page has no Edit or Backup button.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/234 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/horizon-menus-delete-world` --- ### 📝 Commits (1) - [`4d7ca0f`](https://github.com/horizon-rust/horizon/commit/4d7ca0fc937da36c8246c3649ff7237058126eb6) Horizon menus: delete singleplayer worlds ### 📊 Changes **5 files changed** (+349 additions, -47 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/front.rs` (+247 -36) 📝 `crates/horizon-client/src/game.rs` (+4 -0) 📝 `crates/horizon-client/src/title.rs` (+26 -10) 📝 `crates/horizon-client/src/title/tests.rs` (+28 -0) 📝 `crates/horizon-client/src/title/world_management.rs` (+44 -1) </details> ### 📄 Description ## What The Horizon-style Singleplayer page can now delete worlds. Select a world and a **Delete** (danger) button shows beside Play. It opens a confirmation page in the design language: "Delete this world?", "It will be lost forever. This can't be undone." (vanilla's selectWorld.deleteQuestion/deleteWarning), and a notice led by the danger dot with the world's name, its last-played date and its folder. Then **Delete world** (danger) and **Cancel** (ghost). After a delete the list refreshes and the selection moves to the world that took the deleted row, or to the new last world, or to nothing if the list is empty. If a delete fails, a Horizon error page shows, and its Back button returns to the question. ## Why Ludovic: "make it so we can delete the saves we have of worlds". Classic menus already had this (#177). The Horizon menus only had Delete for servers. ## How - `world_management::delete` is shared by both menu styles and ports `LevelStorageAccess.deleteLevel`. It takes the world's `session.lock` first, so a world open in this or another instance is refused. It deletes everything but the lock, retrying up to 5 times 500 ms apart, then releases and removes the lock and the folder. It only accepts a single plain folder name directly inside saves, and it removes links inside the world without following them. - `Title::confirm_delete` is the common confirm step. The Classic Delete/Cancel buttons now go through it and `escape`. - `close_world` now flushes the region writer and releases the session lock, as vanilla closes the storage access. Before this, the lock was held until the next world opened, so the world you just left could not be deleted. - Edit and Backup are still on the classic screens (unchanged), and so are their errors. ## How tested - New unit tests: `front::tests::horizon_world_delete_confirms_and_keeps_the_selection_in_place` (button only shows with a selection; Cancel keeps the world; selection after deleting a middle row and the last row; a locked world shows the Horizon error page and Back returns to the question) and `title::tests::delete_refuses_an_open_world_then_removes_it_with_its_lock`, `delete_removes_links_without_following_them`. - Mac mini: `cargo clippy --workspace --all-targets -D warnings` clean. `cargo test -p horizon-client --lib title:: front:: save::tests::session` gives 21 passed. rustfmt applied. - **Not done:** vscreen screenshots of the new page (stopped by the budget cut). A Linux client build from this branch plus #cursor compiled fine on the ThinkPad. ## Follow-up (not built) Edit (rename / icon / open folder) and Backup have no Horizon pages yet: they still open the classic screens from the Classic world list. The Horizon Singleplayer page has no Edit or Backup button. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:55:58 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2422
No description provided.