diff --git a/applications/services/gui/modules/text_input.c b/applications/services/gui/modules/text_input.c index 32607e884..9004304cb 100644 --- a/applications/services/gui/modules/text_input.c +++ b/applications/services/gui/modules/text_input.c @@ -138,7 +138,7 @@ static bool char_is_lowercase(char letter) { static char char_to_uppercase(const char letter) { if(letter == '_') { return 0x20; - } else if(islower(letter)) { + } else if(isalpha(letter)) { return (letter - 0x20); } else { return letter; @@ -309,9 +309,7 @@ static void text_input_handle_ok(TextInput* text_input, TextInputModel* model, b char selected = get_selected_char(model); size_t text_length = strlen(model->text_buffer); - bool toogle_case = text_length == 0; - if(shift) toogle_case = !toogle_case; - if(toogle_case) { + if(shift) { selected = char_to_uppercase(selected); } @@ -331,6 +329,9 @@ static void text_input_handle_ok(TextInput* text_input, TextInputModel* model, b text_length = 0; } if(text_length < (model->text_buffer_size - 1)) { + if(text_length == 0 && char_is_lowercase(selected)) { + selected = char_to_uppercase(selected); + } model->text_buffer[text_length] = selected; model->text_buffer[text_length + 1] = 0; } @@ -567,4 +568,4 @@ void* text_input_get_validator_callback_context(TextInput* text_input) { void text_input_set_header_text(TextInput* text_input, const char* text) { with_view_model( text_input->view, TextInputModel * model, { model->header = text; }, true); -} +} \ No newline at end of file