[PR #6237] [MERGED] Keep the selected layer row after deleting a flat layer #6735

Closed
opened 2026-11-03 06:25:51 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6237
Author: @MSedgeMC
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/flat-delete-select


📝 Commits (2)

  • 1384ae3 Keep the selected layer row after deleting a flat layer
  • b16454f Merge remote-tracking branch 'origin/main' into s6237

📊 Changes

1 file changed (+20 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/title/flat.rs (+20 -2)

📄 Description

CreateFlatWorldScreen.DetailsList.deleteLayer:

// javap -p -c on CreateFlatWorldScreen$DetailsList
21: istore_3                                  // the row's index
24: invokevirtual removeEntry
32: invokeinterface List.remove               // the layer itself
38: ifeq 52 ... 48: aconst_null                // empty list: nothing selected
52: children(), Math.min(index, layers.size())  // the same row, or the last
74: invokevirtual setSelected

Horizon removed the layer and set selected = None, so after deleting a layer (with the
Backspace button or Delete) nothing was selected and the next edit hit nothing.

Proven: on the build VM, cargo test -q -p horizon-client --lib title::flat::tests
→ 2 passed, including the new deleting_a_layer_keeps_the_selection_in_place
(row stays, last row clamps to the new last, empty list selects nothing). The three
one-line changes were compile-checked together with cargo check -p horizon-client --lib --bins.

Not proven: not checked in game; the check is deleting a middle layer and the last layer
on the Create New World screen and watching which row stays highlighted.

Note (added after the crate split): the tests under crates/horizon-client/src/ other than game/ and entry/ are now compiled by the horizon-client-lib crate, so the command above is cargo test -p horizon-client-lib --lib <filter> on current main. The change and the assertions are unchanged.


🔄 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/6237 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/flat-delete-select` --- ### 📝 Commits (2) - [`1384ae3`](https://github.com/horizon-rust/horizon/commit/1384ae37e72a4f501a7462fb3661c7c4ef6c19e6) Keep the selected layer row after deleting a flat layer - [`b16454f`](https://github.com/horizon-rust/horizon/commit/b16454fd22579977910d79ef43f7b590fe4dce1f) Merge remote-tracking branch 'origin/main' into s6237 ### 📊 Changes **1 file changed** (+20 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/title/flat.rs` (+20 -2) </details> ### 📄 Description `CreateFlatWorldScreen.DetailsList.deleteLayer`: ```java // javap -p -c on CreateFlatWorldScreen$DetailsList 21: istore_3 // the row's index 24: invokevirtual removeEntry 32: invokeinterface List.remove // the layer itself 38: ifeq 52 ... 48: aconst_null // empty list: nothing selected 52: children(), Math.min(index, layers.size()) // the same row, or the last 74: invokevirtual setSelected ``` Horizon removed the layer and set `selected = None`, so after deleting a layer (with the Backspace button or Delete) nothing was selected and the next edit hit nothing. **Proven:** on the build VM, `cargo test -q -p horizon-client --lib title::flat::tests` → `2 passed`, including the new `deleting_a_layer_keeps_the_selection_in_place` (row stays, last row clamps to the new last, empty list selects nothing). The three one-line changes were compile-checked together with `cargo check -p horizon-client --lib --bins`. **Not proven:** not checked in game; the check is deleting a middle layer and the last layer on the Create New World screen and watching which row stays highlighted. Note (added after the crate split): the tests under `crates/horizon-client/src/` other than `game/` and `entry/` are now compiled by the `horizon-client-lib` crate, so the command above is `cargo test -p horizon-client-lib --lib <filter>` on current main. The change and the assertions are unchanged. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:25:51 +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#6735
No description provided.