text edit: integration [not finished]

This commit is contained in:
2026-07-24 16:49:29 +03:00
parent 01303ffccc
commit 21bcf119e3
2 changed files with 24 additions and 17 deletions
+1
View File
@@ -140,6 +140,7 @@ void wait_register(query_args_t *q_args) {
int upload_confirm_cb(app_t *app, char *query, int q_len) { int upload_confirm_cb(app_t *app, char *query, int q_len) {
if (!strncmp("finished\n", query, sizeof("finished\n") - 1)) { if (!strncmp("finished\n", query, sizeof("finished\n") - 1)) {
/* TODO: DESCRIPTION HERE */
w_notification("File upload", dc_normal, w_notification("File upload", dc_normal,
"File %s is uploaded to the server!", "File %s is uploaded to the server!",
app->query_args->file->name); app->query_args->file->name);
+23 -17
View File
@@ -132,12 +132,6 @@ static void w_te_cb(w_cb_args_t *args) {
fui->lines_top_indent++; fui->lines_top_indent++;
} }
break; break;
case KEY_F(2):
/* Save */
break;
case KEY_F(8):
/* Cancel */
break;
default: default:
key = u_utf8_get_full_letter(key, app->win); key = u_utf8_get_full_letter(key, app->win);
if (fui->cur_line_pos == fui->cur_line->len) { if (fui->cur_line_pos == fui->cur_line->len) {
@@ -174,20 +168,31 @@ static int32_t process_user_input(app_t *app, w_cb_args_t *d_args) {
int32_t c; int32_t c;
w_te_ui_t *fui = (w_te_ui_t *)app->query_args->main_ui->ui; w_te_ui_t *fui = (w_te_ui_t *)app->query_args->main_ui->ui;
c = wgetch(app->win); c = wgetch(app->win);
int text_pos = 0;
w_te_ui_line_t *arr_line = NULL;
switch (c) { switch (c) {
case KEY_F(9): case KEY_F(9):
app_destroy(app, 0); app_destroy(app, 0);
return OK; return OK;
case 'D': case KEY_F(2):
case 'd': /* TODO: move to description edit */
// case '\33': /* ESC key */ app->query_args->file->description =
// if (!app->modal.is_initiated) { malloc(sizeof(wchar_t) * (fui->sym_count + 9));
// server_send_string(app->query_args, "file list %d %d\n", for (int i = 0; i < fui->lines_count; i++) {
// fui->max_lines - 1, 1); arr_line = fui->lines_arr.arr[i];
// main_window_set(app, mw_fl_server); text_pos += wcstombs(app->query_args->file->description + text_pos,
// d_args->element = app->main_ui.ui; arr_line->text, arr_line->len);
// break; app->query_args->file->description[text_pos++] = '\n';
// } }
// app->query_args->file->description[--text_pos] = '\03'; /* ETX symbol */
app->query_args->file->description[text_pos] = '\03'; /* ETX symbol */
strncpy(app->query_args->file->description + text_pos, ":END:\n",
sizeof(":END:\n"));
/* Save */
break;
case KEY_F(8):
/* Cancel */
break;
default: default:
d_args->data = (void *)&c; d_args->data = (void *)&c;
app->active_callback(d_args); app->active_callback(d_args);
@@ -303,7 +308,8 @@ void w_te_draw(w_te_ui_t *fui) {
} }
void w_te_destroy(w_te_ui_t **fui) { void w_te_destroy(w_te_ui_t **fui) {
w_te_ui_t *f = *fui; w_te_ui_t *_fui = *fui;
u_d_arr_free_cb(&(_fui->lines_arr), line_destroy_cb);
free(*fui); free(*fui);
*fui = NULL; *fui = NULL;
} }