1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:17:35 +00:00

Userland: Replace manual checking by using GUI::InputType::NonemptyText

Do this where we were already checking if the input was empty after the
InputBox was submitted. Those places gain interactive input validation.

:^)
This commit is contained in:
Karol Baraniecki 2022-12-30 00:06:01 +01:00 committed by Andrew Kaster
parent 55dbfd24c0
commit 8095d9276b
9 changed files with 13 additions and 14 deletions

View file

@ -70,7 +70,7 @@ CharacterMapWidget::CharacterMapWidget()
m_go_to_glyph_action = GUI::Action::create("Go to glyph...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
DeprecatedString input;
if (GUI::InputBox::show(window(), input, "Hexadecimal:"sv, "Go to glyph"sv) == GUI::InputBox::ExecResult::OK && !input.is_empty()) {
if (GUI::InputBox::show(window(), input, "Hexadecimal:"sv, "Go to glyph"sv, {}, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) {
auto maybe_code_point = AK::StringUtils::convert_to_uint_from_hex(input);
if (!maybe_code_point.has_value())
return;