[PR #1990] [MERGED] Edit the remaining text fields at the caret #3918

Closed
opened 2026-11-03 04:13:15 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/server-text-caret


📝 Commits (5)

  • 060a37d Edit the remaining text fields at the caret.
  • fa8291f Treat a line break as a word boundary in text fields.
  • 0e49658 Book pages: move by words as MultilineTextField does
  • ae3b844 Merge main into fix/server-text-caret
  • 453ee22 Merge main into fix/server-text-caret

📊 Changes

11 files changed (+931 additions, -392 deletions)

View changed files

📝 crates/horizon-client/src/clipboard.rs (+5 -0)
📝 crates/horizon-client/src/creative.rs (+40 -15)
📝 crates/horizon-client/src/game.rs (+48 -18)
📝 crates/horizon-client/src/game/books.rs (+338 -143)
📝 crates/horizon-client/src/game/clipboard.rs (+13 -24)
📝 crates/horizon-client/src/game/sign_edit.rs (+225 -89)
📝 crates/horizon-client/src/game/stations.rs (+83 -34)
📝 crates/horizon-client/src/multiplayer.rs (+66 -54)
📝 crates/horizon-client/src/title.rs (+8 -11)
📝 crates/horizon-client/src/title/tests.rs (+47 -0)
📝 crates/horizon-client/src/ui.rs (+58 -4)

📄 Description

🤖 Opened by Joansitoh's AI agent (Cursor), not by Joansitoh.

What and why

The text fields that still only appended now use the same caret as the world screens. The cursor moves, a selection can be made, and the arrow keys, Home, End, Backspace and Delete work. That covers Add Server and Edit Server, Direct Connection, the friend code and relay, creative search, the anvil name, sign lines, and the book title and page.

A sign paste goes through TextFieldHelper.getClipboardContents before insertText, so §aHello is stored as Hello. A paste that does not fit the line is refused whole.

This is one change. It is over the 500 line guide: the fields share the caret, and splitting them would ship some inputs still append-only.

No open issue covers the remaining fields. #383 was closed by #452 for the world screens. #423 laid out the server list and left these boxes.

Vanilla reference

Read with javap -c -p on the 26.3 client jar.

  • net.minecraft.client.gui.components.EditBox.keyPressed: Left and Right (by word with Ctrl, Shift extends the selection), Home, End, Backspace, Delete, Select All, Copy, Paste (KeyboardHandler.getClipboard then insertText) and Cut.
  • EditBox.onClick: a double click calls selectWord. Otherwise findClickedPositionInText and moveCursorTo. Shift extends the selection.
  • EditBox.onDrag: findClickedPositionInText, then moveCursorTo with the selection held.
  • net.minecraft.client.gui.font.TextFieldHelper.getClipboardContents: KeyboardHandler.getClipboard, carriage returns removed, then ChatFormatting.stripFormatting.
  • TextFieldHelper.keyPressed calls paste on paste. paste reads the clipboard getter and calls insertText. insertText(String, String) builds the whole line and returns without setMessage when stringValidator fails.
  • AbstractSignEditScreen builds the field with TextFieldHelper.createClipboardGetter. lambda$new$1 keeps a line when Font.width is at most SignBlockEntity.getMaxTextLineWidth.

Harness: none. The caret is covered by title::tests::server_fields_edit_at_their_cursor, creative::tests::search_edits_at_its_cursor, and clipboard::tests::filter_text_keeps_line_breaks_only_for_multiline_fields (§aHello becomes Hello when the strip runs before the chat filter).

Self-check

**pr_ready** (`tools/pr_ready.py` on LAJENNY, against origin/main at 6df37324f, 6 min 26 s)

| Check | Result |
| --- | --- |
| Scope | ⚠️ 13 files, +885 −390; 1275 lines of code: over 500, split it if it can ship in parts |
| Cargo.lock | ✅ unchanged |
| Public tree | ✅ |
| Python tests | ➖ no Python change |
| rustfmt | ✅ (14 s) |
| clippy | ❌ failed (39 s) |
| tests: horizon-client | ❌ 1106 passed, 3 failed (5 min 2 s) |
| doc tests | ✅ 0 passed (19 s) |
| tokens.css up to date | ➖ theme untouched |
| launcher rustfmt | ➖ launcher untouched |
| launcher clippy | ➖ launcher untouched |
| launcher tests | ➖ launcher untouched |
| Parity | ❌ 343 affected,  (4 s) |
| Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) |

The scope line counts two untracked files under downloads/. They are local and are not in this commit. The commit is 11 files, +882 −390.

Clippy failed in crates/horizon-world/src/worldgen/aquifer/noise_based.rs (manual_range_contains). Linting this crate's binary also reports the same lint in crates/horizon-client/src/game/dragon.rs. Neither file is part of this change.

The three test failures are Windows-only and are not this change: packs::cache::tests::directory_inputs_config_and_owned_output_recovery (set_times, access denied), save::tests::session_lock_is_exclusive (a byte-range lock on session.lock), and crash::tests::stacks_start_at_the_panicking_frame (the manifest path is stripped to /src/crash.rs).

Parity died on import fcntl in tools/parity.py before a harness ran.

Screenshots

Checked in a local game on Add Server, Direct Connection, creative search, the anvil name, sign lines, and the book title and page. The caret moves, text selects, and the arrow keys work.

🤖 Generated with Cursor.


🔄 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/1990 **Author:** [@Joansitoh](https://github.com/Joansitoh) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/server-text-caret` --- ### 📝 Commits (5) - [`060a37d`](https://github.com/horizon-rust/horizon/commit/060a37dc8536328017f7759ee710a55481c18c42) Edit the remaining text fields at the caret. - [`fa8291f`](https://github.com/horizon-rust/horizon/commit/fa8291fc974a2b1290b7538022440696c15726d9) Treat a line break as a word boundary in text fields. - [`0e49658`](https://github.com/horizon-rust/horizon/commit/0e4965845a2779a932c75ecc7c6c9803d9bd86ba) Book pages: move by words as MultilineTextField does - [`ae3b844`](https://github.com/horizon-rust/horizon/commit/ae3b844d74d779ba94376f46f5e51779401b2358) Merge main into fix/server-text-caret - [`453ee22`](https://github.com/horizon-rust/horizon/commit/453ee223768907dafc7b343533390d3f31c7c651) Merge main into fix/server-text-caret ### 📊 Changes **11 files changed** (+931 additions, -392 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/clipboard.rs` (+5 -0) 📝 `crates/horizon-client/src/creative.rs` (+40 -15) 📝 `crates/horizon-client/src/game.rs` (+48 -18) 📝 `crates/horizon-client/src/game/books.rs` (+338 -143) 📝 `crates/horizon-client/src/game/clipboard.rs` (+13 -24) 📝 `crates/horizon-client/src/game/sign_edit.rs` (+225 -89) 📝 `crates/horizon-client/src/game/stations.rs` (+83 -34) 📝 `crates/horizon-client/src/multiplayer.rs` (+66 -54) 📝 `crates/horizon-client/src/title.rs` (+8 -11) 📝 `crates/horizon-client/src/title/tests.rs` (+47 -0) 📝 `crates/horizon-client/src/ui.rs` (+58 -4) </details> ### 📄 Description > 🤖 Opened by Joansitoh's AI agent (Cursor), not by Joansitoh. ## What and why The text fields that still only appended now use the same caret as the world screens. The cursor moves, a selection can be made, and the arrow keys, Home, End, Backspace and Delete work. That covers Add Server and Edit Server, Direct Connection, the friend code and relay, creative search, the anvil name, sign lines, and the book title and page. A sign paste goes through `TextFieldHelper.getClipboardContents` before `insertText`, so `§aHello` is stored as `Hello`. A paste that does not fit the line is refused whole. This is one change. It is over the 500 line guide: the fields share the caret, and splitting them would ship some inputs still append-only. No open issue covers the remaining fields. #383 was closed by #452 for the world screens. #423 laid out the server list and left these boxes. ## Vanilla reference Read with `javap -c -p` on the 26.3 client jar. - `net.minecraft.client.gui.components.EditBox.keyPressed`: Left and Right (by word with Ctrl, Shift extends the selection), Home, End, Backspace, Delete, Select All, Copy, Paste (`KeyboardHandler.getClipboard` then `insertText`) and Cut. - `EditBox.onClick`: a double click calls `selectWord`. Otherwise `findClickedPositionInText` and `moveCursorTo`. Shift extends the selection. - `EditBox.onDrag`: `findClickedPositionInText`, then `moveCursorTo` with the selection held. - `net.minecraft.client.gui.font.TextFieldHelper.getClipboardContents`: `KeyboardHandler.getClipboard`, carriage returns removed, then `ChatFormatting.stripFormatting`. - `TextFieldHelper.keyPressed` calls `paste` on paste. `paste` reads the clipboard getter and calls `insertText`. `insertText(String, String)` builds the whole line and returns without `setMessage` when `stringValidator` fails. - `AbstractSignEditScreen` builds the field with `TextFieldHelper.createClipboardGetter`. `lambda$new$1` keeps a line when `Font.width` is at most `SignBlockEntity.getMaxTextLineWidth`. Harness: none. The caret is covered by `title::tests::server_fields_edit_at_their_cursor`, `creative::tests::search_edits_at_its_cursor`, and `clipboard::tests::filter_text_keeps_line_breaks_only_for_multiline_fields` (`§aHello` becomes `Hello` when the strip runs before the chat filter). ## Self-check ``` **pr_ready** (`tools/pr_ready.py` on LAJENNY, against origin/main at 6df37324f, 6 min 26 s) | Check | Result | | --- | --- | | Scope | ⚠️ 13 files, +885 −390; 1275 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (14 s) | | clippy | ❌ failed (39 s) | | tests: horizon-client | ❌ 1106 passed, 3 failed (5 min 2 s) | | doc tests | ✅ 0 passed (19 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ❌ 343 affected, (4 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | ``` The scope line counts two untracked files under `downloads/`. They are local and are not in this commit. The commit is 11 files, +882 −390. Clippy failed in `crates/horizon-world/src/worldgen/aquifer/noise_based.rs` (`manual_range_contains`). Linting this crate's binary also reports the same lint in `crates/horizon-client/src/game/dragon.rs`. Neither file is part of this change. The three test failures are Windows-only and are not this change: `packs::cache::tests::directory_inputs_config_and_owned_output_recovery` (`set_times`, access denied), `save::tests::session_lock_is_exclusive` (a byte-range lock on `session.lock`), and `crash::tests::stacks_start_at_the_panicking_frame` (the manifest path is stripped to `/src/crash.rs`). Parity died on `import fcntl` in `tools/parity.py` before a harness ran. ## Screenshots Checked in a local game on Add Server, Direct Connection, creative search, the anvil name, sign lines, and the book title and page. The caret moves, text selects, and the arrow keys work. 🤖 Generated with [Cursor](https://cursor.com). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:13:15 +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#3918
No description provided.