[PR #2131] [CLOSED] Launcher: every text field uses the shared LineEdit #4033

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2131
Author: @Joansitoh
Created: 10/26/2026
Status: ❌ Closed

Base: main ← Head: refactor/launcher-fields-share-line-edit


📝 Commits (3)

  • 2f6f0e3 Launcher: Game arguments edits at the caret
  • 9cebcc8 Launcher: a paste keeps the spaces at its ends
  • 9458e6e Launcher: every text field uses the shared LineEdit

📊 Changes

5 files changed (+801 additions, -283 deletions)

View changed files

📝 launcher/src/internet.rs (+2 -2)
➕ launcher/src/line_edit.rs (+707 -0)
📝 launcher/src/main.rs (+40 -69)
📝 launcher/src/mods_page.rs (+17 -37)
📝 launcher/src/servers_page.rs (+35 -175)

📄 Description

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

Stacked on #2130: until it merges, this PR's diff on GitHub also shows that commit. The change that is only this PR is the last commit (+107 −251). Opened as a draft for that reason.

What and why

#2130 adds LineEdit, a one-line field with a caret, selection, mouse and undo, and moves Game arguments onto it. The other launcher inputs have the same fault (append-only, Space dropped on Windows, no selection or undo), because each had its own String and its own copy of the key code. This moves them onto the same field.

How

  • Join a friend and the mods search: String becomes LineEdit; their key handlers shrink to Enter and Escape, and the rest is line_edit::handle.
  • Servers (servers_page.rs): texts: HashMap<Field, LineEdit>. One handler serves every field (Create dialog, Players, console, MOTD, port, token, email). A selected suggestion is still replaced by what's typed or pasted: it is select_all() before the key, and drawn selected. The token field still shows dots (mask).
  • LineEdit gains set, take, show and Default, which the Servers code needs (text(f) creates a field on first use, and the page sets or empties it). Their test is next to them.
  • Deleted: type_key, the Servers Key enum and clip. LineEdit::key does what type_key did (Enter, Escape, Space without a character, Backspace on a suggestion, Pass for Tab and shortcuts), and its length limit replaces clip. The test fields_type_as_people_expect moves to line_edit.rs as the typing, undo and selection tests of #2130.
  • Escape drops the focus in Join a friend and the mods search (the Servers fields already did).

Vanilla reference

Horizon-only (the launcher).

Self-check

**pr_ready** (`tools/pr_ready.py --quick`, against #2130's branch)

| Check | Result |
| --- | --- |
| Public tree | ✅ |
| launcher rustfmt | ✅ |
| launcher clippy | ✅ |
| launcher tests | ✅ 125 passed |
| Scope | +107 −251 over #2130 |

Checked by hand in the launcher on Windows with #2130 below it. Servers fields were not run against a live server.

🤖 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/2131 **Author:** [@Joansitoh](https://github.com/Joansitoh) **Created:** 10/26/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `refactor/launcher-fields-share-line-edit` --- ### 📝 Commits (3) - [`2f6f0e3`](https://github.com/horizon-rust/horizon/commit/2f6f0e3e0f22c91d1cf7205563e2574d75d6f570) Launcher: Game arguments edits at the caret - [`9cebcc8`](https://github.com/horizon-rust/horizon/commit/9cebcc8d7fc6dea42402b08d83ca84c4698af6c0) Launcher: a paste keeps the spaces at its ends - [`9458e6e`](https://github.com/horizon-rust/horizon/commit/9458e6e99e1405f59a97a4255b712f15b6f10b04) Launcher: every text field uses the shared LineEdit ### 📊 Changes **5 files changed** (+801 additions, -283 deletions) <details> <summary>View changed files</summary> 📝 `launcher/src/internet.rs` (+2 -2) ➕ `launcher/src/line_edit.rs` (+707 -0) 📝 `launcher/src/main.rs` (+40 -69) 📝 `launcher/src/mods_page.rs` (+17 -37) 📝 `launcher/src/servers_page.rs` (+35 -175) </details> ### 📄 Description > 🤖 Opened by Joansitoh's AI agent (Claude Code), not by Joansitoh. Stacked on #2130: until it merges, this PR's diff on GitHub also shows that commit. The change that is only this PR is the last commit (`+107 −251`). Opened as a draft for that reason. ## What and why #2130 adds `LineEdit`, a one-line field with a caret, selection, mouse and undo, and moves Game arguments onto it. The other launcher inputs have the same fault (append-only, Space dropped on Windows, no selection or undo), because each had its own `String` and its own copy of the key code. This moves them onto the same field. ## How - **Join a friend** and the **mods search**: `String` becomes `LineEdit`; their key handlers shrink to Enter and Escape, and the rest is `line_edit::handle`. - **Servers** (`servers_page.rs`): `texts: HashMap<Field, LineEdit>`. One handler serves every field (Create dialog, Players, console, MOTD, port, token, email). A selected suggestion is still replaced by what's typed or pasted: it is `select_all()` before the key, and drawn selected. The token field still shows dots (`mask`). - `LineEdit` gains `set`, `take`, `show` and `Default`, which the Servers code needs (`text(f)` creates a field on first use, and the page sets or empties it). Their test is next to them. - Deleted: `type_key`, the Servers `Key` enum and `clip`. `LineEdit::key` does what `type_key` did (Enter, Escape, Space without a character, Backspace on a suggestion, Pass for Tab and shortcuts), and its length limit replaces `clip`. The test `fields_type_as_people_expect` moves to `line_edit.rs` as the typing, undo and selection tests of #2130. - Escape drops the focus in Join a friend and the mods search (the Servers fields already did). ## Vanilla reference Horizon-only (the launcher). ## Self-check ``` **pr_ready** (`tools/pr_ready.py --quick`, against #2130's branch) | Check | Result | | --- | --- | | Public tree | ✅ | | launcher rustfmt | ✅ | | launcher clippy | ✅ | | launcher tests | ✅ 125 passed | | Scope | +107 −251 over #2130 | ``` Checked by hand in the launcher on Windows with #2130 below it. Servers fields were not run against a live server. 🤖 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-03 04:14:10 +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#4033
No description provided.