[PR #2130] [MERGED] Launcher: Game arguments edits at the caret #4030

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

📋 Pull Request Information

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

Base: main ← Head: fix/launcher-text-field-edit


📝 Commits (4)

  • 2f6f0e3 Launcher: Game arguments edits at the caret
  • 9cebcc8 Launcher: a paste keeps the spaces at its ends
  • 712306d Merge main into #2130 (launcher: the args field stays a LineEdit beside main's proxy field)
  • cbbf6f8 Merge main into fix/launcher-text-field-edit (main.rs: keep main's background_error and the LineEdit field)

📊 Changes

2 files changed (+698 additions, -33 deletions)

View changed files

➕ launcher/src/line_edit.rs (+678 -0)
📝 launcher/src/main.rs (+20 -33)

📄 Description

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

What and why

Settings → Game → Game arguments only appended characters and popped the last one. You couldn't move the caret, select, paste into the middle, undo, or type a space: on Windows Space arrives without a character (key_char is None), and the field only typed what had one, so --name Testingnick was impossible. No open issue covers it (#716 and #719 added the field).

The cause is the field, not the key handling around it: each launcher input kept its own String plus its own copy of the key code. This adds the one-line field they can share, launcher/src/line_edit.rs, and moves Game arguments onto it. The other inputs (Join a friend, mods search, the Servers fields) move in the next PR, which deletes their copies.

How

  • LineEdit holds the text, caret, selection, scroll and undo history. Positions count characters.
  • Keyboard: Left/Right, Home/End, Ctrl+Left/Right by word, Shift extends the selection, Backspace/Delete (Ctrl for a word), Ctrl+A, Ctrl+C/X/V (paste takes the clipboard's first line), Space typed even without a character.
  • Mouse: click puts the caret in, Shift+click extends, drag selects, double click picks a word, triple click the line. A canvas inside the field records where the text is drawn and in which font; the click is turned into a character with ShapedLine::closest_index_for_x, the way GPUI's own input example does it.
  • Undo (Ctrl+Z, Ctrl+Y or Ctrl+Shift+Z): typing undoes a word at a time, a run of Backspace is one step, paste/cut/replacing a selection are a step each. An edit that changes nothing (a t typed over a selected t) is not a step.
  • content() draws the text, selection and caret; handle() is the keyboard plus the clipboard. A page keeps its own box and its Enter/Escape. Escape drops the focus.

Vanilla reference

Horizon-only (the launcher). Follows the design system: the field keeps its box and uses SELECTION for the highlight.

Self-check

**pr_ready** (`tools/pr_ready.py --quick` against origin/main at 43929f3ff)

| Check | Result |
| --- | --- |
| Public tree | ✅ |
| launcher rustfmt | ✅ |
| launcher clippy | ✅ |
| launcher tests | ✅ 125 passed |
| Scope | ⚠️ +695 −33: about 190 lines are tests, 190 the keyboard and undo |

Checked by hand in the launcher on Windows: typing with spaces, caret keys, selection with Shift and with the mouse, Ctrl+A/C/X/V, Ctrl+Z/Y.

On size: the scope check flags it as over 500, but the field is one unit (the state, the keyboard and what it draws), and splitting it would leave unused code that fails clippy.

🤖 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/2130 **Author:** [@Joansitoh](https://github.com/Joansitoh) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/launcher-text-field-edit` --- ### 📝 Commits (4) - [`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 - [`712306d`](https://github.com/horizon-rust/horizon/commit/712306d3b95daca21f1fe75ef77c595edb3f71ee) Merge main into #2130 (launcher: the args field stays a LineEdit beside main's proxy field) - [`cbbf6f8`](https://github.com/horizon-rust/horizon/commit/cbbf6f8b2e6a5b603f480413f701b554eef00a95) Merge main into fix/launcher-text-field-edit (main.rs: keep main's background_error and the LineEdit field) ### 📊 Changes **2 files changed** (+698 additions, -33 deletions) <details> <summary>View changed files</summary> ➕ `launcher/src/line_edit.rs` (+678 -0) 📝 `launcher/src/main.rs` (+20 -33) </details> ### 📄 Description > 🤖 Opened by Joansitoh's AI agent (Claude Code), not by Joansitoh. ## What and why Settings → Game → **Game arguments** only appended characters and popped the last one. You couldn't move the caret, select, paste into the middle, undo, or type a space: on Windows Space arrives without a character (`key_char` is `None`), and the field only typed what had one, so `--name Testingnick` was impossible. No open issue covers it (#716 and #719 added the field). The cause is the field, not the key handling around it: each launcher input kept its own `String` plus its own copy of the key code. This adds the one-line field they can share, `launcher/src/line_edit.rs`, and moves Game arguments onto it. The other inputs (Join a friend, mods search, the Servers fields) move in the next PR, which deletes their copies. ## How - `LineEdit` holds the text, caret, selection, scroll and undo history. Positions count characters. - Keyboard: Left/Right, Home/End, Ctrl+Left/Right by word, Shift extends the selection, Backspace/Delete (Ctrl for a word), Ctrl+A, Ctrl+C/X/V (paste takes the clipboard's first line), Space typed even without a character. - Mouse: click puts the caret in, Shift+click extends, drag selects, double click picks a word, triple click the line. A `canvas` inside the field records where the text is drawn and in which font; the click is turned into a character with `ShapedLine::closest_index_for_x`, the way GPUI's own input example does it. - Undo (Ctrl+Z, Ctrl+Y or Ctrl+Shift+Z): typing undoes a word at a time, a run of Backspace is one step, paste/cut/replacing a selection are a step each. An edit that changes nothing (a `t` typed over a selected `t`) is not a step. - `content()` draws the text, selection and caret; `handle()` is the keyboard plus the clipboard. A page keeps its own box and its Enter/Escape. Escape drops the focus. ## Vanilla reference Horizon-only (the launcher). Follows [the design system](docs/design-system.md): the field keeps its box and uses `SELECTION` for the highlight. ## Self-check ``` **pr_ready** (`tools/pr_ready.py --quick` against origin/main at 43929f3ff) | Check | Result | | --- | --- | | Public tree | ✅ | | launcher rustfmt | ✅ | | launcher clippy | ✅ | | launcher tests | ✅ 125 passed | | Scope | ⚠️ +695 −33: about 190 lines are tests, 190 the keyboard and undo | ``` Checked by hand in the launcher on Windows: typing with spaces, caret keys, selection with Shift and with the mouse, Ctrl+A/C/X/V, Ctrl+Z/Y. On size: the scope check flags it as over 500, but the field is one unit (the state, the keyboard and what it draws), and splitting it would leave unused code that fails clippy. 🤖 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:09 +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#4030
No description provided.