mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-26 03:39:58 -07:00
Fix keyboard capitalization bug (_ and space)
This commit is contained in:
@@ -237,8 +237,7 @@ static void text_input_view_draw_callback(Canvas* canvas, void* _model) {
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
}
|
||||
|
||||
if(model->clear_default_text ||
|
||||
(text_length == 0 && char_is_lowercase(keys[column].text))) {
|
||||
if((model->clear_default_text || text_length == 0) && char_is_lowercase(keys[column].text)) {
|
||||
canvas_draw_glyph(
|
||||
canvas,
|
||||
keyboard_origin_x + keys[column].x,
|
||||
@@ -309,10 +308,6 @@ 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);
|
||||
|
||||
if(shift) {
|
||||
selected = char_to_uppercase(selected);
|
||||
}
|
||||
|
||||
if(selected == ENTER_KEY) {
|
||||
if(model->validator_callback &&
|
||||
(!model->validator_callback(
|
||||
@@ -329,7 +324,7 @@ 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)) {
|
||||
if(shift || (text_length == 0 && char_is_lowercase(selected))) {
|
||||
selected = char_to_uppercase(selected);
|
||||
}
|
||||
model->text_buffer[text_length] = selected;
|
||||
@@ -568,4 +563,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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user