From 95c8e56559a3523ec77e105684b174c80ff4552e Mon Sep 17 00:00:00 2001 From: Alexander Zhylin Date: Wed, 13 May 2026 18:26:39 +0300 Subject: [PATCH] ui: updates TODO.md --- TODO.md | 4 +++- src/modals/upload_dialogue.c | 3 ++- src/widget/input.c | 9 ++++++--- src/widget/input.h | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/TODO.md b/TODO.md index c03a9c2..604a9ef 100644 --- a/TODO.md +++ b/TODO.md @@ -1,12 +1,14 @@ # TODO: +- [ ] Input: get rid of char accumulator and use everywhere wchar_t + ## Current: - [ ] File upload multiline description (window) -- [x] Input: fix non-Latin letters - [ ] Separate common structures in the common.h - [ ] Sorting in the file list - [ ] More intuitive navigation between nested groups (by pressing left and right buttons) - [ ] Cancel upload/download +- [x] Input: fix non-Latin letters - [x] Get rid of unsigned integers - [x] Check registration / enter server name again - [x] PageUp/PageDown key functionality in lists diff --git a/src/modals/upload_dialogue.c b/src/modals/upload_dialogue.c index bca7dcf..2a70034 100644 --- a/src/modals/upload_dialogue.c +++ b/src/modals/upload_dialogue.c @@ -1,4 +1,5 @@ /* #include "../file_processor.h" +#include "../windows/fs_file_list.h" #include "group.h" #include "widget_core.h" #include @@ -11,7 +12,7 @@ void upload_dialogue_modal_cb(w_cb_args_t *args) { app_t *app = args->app; w_dialogue_t *d = (w_dialogue_t *)app->active_widget; memcpy(&d_args, args, sizeof(w_cb_args_t)); - /* d_args.app = NULL; */ + d_args.app = NULL; d_args.element = app->active_widget; w_dialogue_callback_default(&d_args); w_lfl_ui_t *fui = (w_lfl_ui_t *)d->g_content->elements[0].element; diff --git a/src/widget/input.c b/src/widget/input.c index 472988e..fac4a66 100644 --- a/src/widget/input.c +++ b/src/widget/input.c @@ -19,6 +19,7 @@ bool w_input_default_key_action(w_cb_args_t *args) { wchar_t w_key[2]; app_t *app = args->app; char long_key[3]; + int short_val_len = 1; switch (key) { case KEY_BACKSPACE: @@ -36,22 +37,24 @@ bool w_input_default_key_action(w_cb_args_t *args) { default: if (input->value_len == input->max_len) break; long_key[0] = key; + input->value_len++; if ((key & 0xC0) == 0xC0) { long_key[1] = wgetch(app->win); long_key[2] = '\0'; + short_val_len++; } else { long_key[1] = '\0'; } mbstowcs(w_key, (const char *)&long_key, 2); if (input->cur_pos > 0) { - start_pos = input->value_len++ - input->cur_pos; + start_pos = input->value_len - input->cur_pos; memmove(input->value + start_pos + 1, input->value + start_pos, input->value_len - start_pos); input->value[start_pos] = key; + strcpy(input->value + start_pos, long_key); input->w_value[start_pos] = w_key[0]; } else { - input->value[input->value_len++] = key; - input->value[input->value_len] = '\0'; + strcpy(input->value + input->value_len, long_key); input->w_value[input->value_len - 1] = w_key[0]; input->w_value[input->value_len] = '\0'; diff --git a/src/widget/input.h b/src/widget/input.h index 0ebf5d3..a4f49c7 100644 --- a/src/widget/input.h +++ b/src/widget/input.h @@ -11,7 +11,7 @@ typedef struct { w_t w; wchar_t w_value[INPUT_TEXT]; - char value[INPUT_TEXT]; + char value[INPUT_TEXT*2]; int32_t cur_pos; /* is relative to the end of a string */ int32_t value_len; int32_t max_len;