XGameUI: maxTextLength=0 is a limit of 1024 characters (#248) #306

Closed
carlos-seiffert wants to merge 1 commit from upstream-pr/306 into main
carlos-seiffert commented 2026-11-24 23:27:45 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by carlos-seiffert on 2026-11-24T23:27:45Z.


Fixes #248.

Summary

  • In crates/victory-hle/src/modules/xgameui.rs, text_entry_async now turns a maxTextLength of 0 into the documented 1024 characters (GDK reference) once, at entry.
  • That one effective limit goes to both the host dialog (EM_LIMITTEXT, which previously got 0, the edit control's own near-unlimited default) and the trimming of the result.
  • A positive limit is kept as given. limit no longer has a "0 means no limit" case.

Tests

  • New zero_length_limit_is_1024_characters: the test dialog answers 1030 characters with a limit of 0, and 1024 characters plus the NUL come back. Without the change it fails (left: 1, right: 1025).
  • cargo test -p victory-hle: 96 passed, 0 failed (Windows 11, Rust 1.98.1, MSVC).
  • cargo clippy -p victory-hle --all-targets: nothing in this file.
  • The live dialog was not exercised.

Only the new lines follow rustfmt.toml's 100 columns. The rest of the file was already wider, and I left it as is to keep the diff small.

🤖 Generated with Claude Code

<!-- greyfinch-sync:fxceless/victory-fork:issue:6593503750 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/306). Originally posted by [carlos-seiffert](https://github.com/carlos-seiffert) on 2026-11-24T23:27:45Z. --- Fixes #248. ### Summary - In `crates/victory-hle/src/modules/xgameui.rs`, `text_entry_async` now turns a `maxTextLength` of 0 into the documented 1024 characters ([GDK reference](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xgameui/functions/xgameuishowtextentryasync)) once, at entry. - That one effective limit goes to both the host dialog (`EM_LIMITTEXT`, which previously got 0, the edit control's own near-unlimited default) and the trimming of the result. - A positive limit is kept as given. `limit` no longer has a "0 means no limit" case. ### Tests - New `zero_length_limit_is_1024_characters`: the test dialog answers 1030 characters with a limit of 0, and 1024 characters plus the NUL come back. Without the change it fails (`left: 1, right: 1025`). - `cargo test -p victory-hle`: 96 passed, 0 failed (Windows 11, Rust 1.98.1, MSVC). - `cargo clippy -p victory-hle --all-targets`: nothing in this file. - The live dialog was not exercised. Only the new lines follow `rustfmt.toml`'s 100 columns. The rest of the file was already wider, and I left it as is to keep the diff small. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-25 00:09:44 +00:00
carlos-seiffert commented 2026-11-25 00:10:08 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by carlos-seiffert on 2026-11-24T23:30:43Z.


Closing as a duplicate of #291, which was opened a few minutes earlier with the same fix (0 → 1024 at entry, one limit for the dialog and the result) and an equivalent test. Sorry for the noise.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7147482432 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/306#issuecomment-7147482432). Originally posted by [carlos-seiffert](https://github.com/carlos-seiffert) on 2026-11-24T23:30:43Z. --- Closing as a duplicate of #291, which was opened a few minutes earlier with the same fix (0 → 1024 at entry, one limit for the dialog and the result) and an equivalent test. Sorry for the noise.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
fxceless/victory-fork!306
No description provided.