hle(xgameui): treat maxTextLength=0 as default 1024-character limit #295
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!295
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-295"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Caasares on GitHub · 2026-11-24 23:21 UTC · original
Caasares:fix/xgameui-max-text-length-zero→main· +121 −22 · 1 files · 1 commits · openFixes #248
Root Cause
Per GDK documentation for
XGameUiShowTextEntryAsync,maxTextLength == 0specifies the default limit of1024characters. Previously,crates/victory-hle/src/modules/xgameui.rs:max_length = 0straight intoask/dialog::ask(EM_LIMITTEXTwithwParam = 0sets the edit control's maximum capacity rather than1024).0as "no limit" insidelimit(typed, max), returning all characters (e.g., all 1025 characters for a 1025-character input).Fix
DEFAULT_MAX_TEXT_LENGTH = 1024andeffective_max_length(max)incrates/victory-hle/src/modules/xgameui.rsto normalize0to1024.max_lengthat entry intext_entry_asyncbefore callingaskandlimit, updatedlimitto cap ateffective_max_length(max)characters, and normalizeddialog::ask/dialog::limit_text_wparamforEM_LIMITTEXT.max_length_zero_applies_1024_defaultandexplicit_positive_limit_and_utf8_boundaries) coveringmaxTextLength = 0on 1025-character ASCII and multi-byte UTF-8 inputs, explicit positive limits (16), shorter pass-through inputs,dialog::limit_text_wparam, and NUL-terminated buffer sizing.Verification
cargo clippy --workspace --all-targets --locked -- -D warnings: passed (0 warnings)cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed (0 warnings)cargo test --workspace --locked: 498 passed, 0 failed, 7 ignored (includingvictory-hle97 passed, 3modules::xgameui::tests::*, andxtask::policy::tests::repository_passes_policy)cargo fmt --all -- --check: fails only on pre-existing unformatted lines outside this diff (also present on pre-existing lines inxgameui.rs); all added/modified lines conform torustfmt.toml.AI-assisted contribution. Contains no game files, code, or assets.
@kaayzouee on GitHub · 2026-11-25 01:12 UTC · original
Duplicate of #291?
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.