From f104955686f78fb03472355dbebc2bf32632da54 Mon Sep 17 00:00:00 2001 From: Federico Amedeo Izzo Date: Tue, 13 Jul 2021 21:12:07 +0200 Subject: [PATCH] Text Input: Delete character by using any arrow button --- openrtx/src/ui/ui.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index 4e366123..4d5bf932 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -754,6 +754,14 @@ void _ui_textInputKeypad(char *buf, uint8_t max_len, kbd_msg_t msg) buf[ui_state.input_position] = symbols_ITU_T_E161[num_key][ui_state.input_set]; } +void _ui_textInputDel(char *buf) +{ + buf[ui_state.input_position] = 0; + if(ui_state.input_position > 0) + ui_state.input_position--; + ui_state.input_set = 0; +} + void ui_saveState() { last_state = state; @@ -1275,6 +1283,9 @@ void ui_updateFSM(event_t event, bool *sync_rtx) else if(msg.keys & KEY_ESC) // Discard selected callsign and disable input mode ui_state.edit_mode = false; + else if(msg.keys & KEY_UP || msg.keys & KEY_DOWN || + msg.keys & KEY_LEFT || msg.keys & KEY_RIGHT) + _ui_textInputDel(ui_state.new_callsign); else if(input_isNumberPressed(msg)) _ui_textInputKeypad(ui_state.new_callsign, 9, msg); }