From 36711fca90c1f96dbb7f71817e03ea70cbc58a37 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Wed, 24 Jan 2024 07:40:45 +0000 Subject: [PATCH] Fix keyboard cursor underflow with ascii events --nobuild --- applications/services/gui/modules/text_input.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/applications/services/gui/modules/text_input.c b/applications/services/gui/modules/text_input.c index fc6be55a6..d076d118e 100644 --- a/applications/services/gui/modules/text_input.c +++ b/applications/services/gui/modules/text_input.c @@ -606,8 +606,10 @@ static bool text_input_view_ascii_callback(AsciiEvent* event, void* context) { model->cursor_pos = CLAMP(model->cursor_pos + 1, strlen(model->text_buffer), 0u); } else { - model->cursor_pos = - CLAMP(model->cursor_pos - 1, strlen(model->text_buffer), 0u); + if(model->cursor_pos > 0) { + model->cursor_pos = + CLAMP(model->cursor_pos - 1, strlen(model->text_buffer), 0u); + } } }, true);