ui: Input: fix non-Latin letters

This commit is contained in:
2026-05-13 17:28:10 +03:00
parent b346e364c5
commit e764964a3c
30 changed files with 377 additions and 135 deletions
+3 -3
View File
@@ -4,7 +4,7 @@
#include <stdlib.h>
#include <string.h>
void u_d_arr_ptr_init(d_array_ptr_t *arr, int64_t init_capacity) {
void u_d_arr_ptr_init(d_array_ptr_t *arr, int32_t init_capacity) {
arr->capacity = init_capacity;
arr->length = 0;
arr->arr = malloc(sizeof(void *) * init_capacity);
@@ -13,8 +13,8 @@ void u_d_arr_ptr_init(d_array_ptr_t *arr, int64_t init_capacity) {
memset(arr->arr, 0, init_capacity);
}
void u_d_arr_ptr_add(d_array_ptr_t *arr, void *ptr, int64_t idx) {
int64_t new_capacity = idx * 2;
void u_d_arr_ptr_add(d_array_ptr_t *arr, void *ptr, int32_t idx) {
int32_t new_capacity = idx * 2;
if (idx > arr->capacity - 1) {
arr->arr = realloc(arr->arr, new_capacity);
memset(arr->arr+arr->capacity, 0, arr->capacity - new_capacity);
+4 -4
View File
@@ -3,15 +3,15 @@
/* Dynamic array of numbers */
#include <stdint.h>
typedef struct d_array_ptr_t {
int64_t capacity;
int64_t length;
int32_t capacity;
int32_t length;
void **arr;
void *fist_el;
void *last_el;
} d_array_ptr_t;
void u_d_arr_ptr_init(d_array_ptr_t *arr, int64_t init_capacity);
void u_d_arr_ptr_add(d_array_ptr_t *arr, void *ptr, int64_t idx);
void u_d_arr_ptr_init(d_array_ptr_t *arr, int32_t init_capacity);
void u_d_arr_ptr_add(d_array_ptr_t *arr, void *ptr, int32_t idx);
void u_d_arr_ptr_free(d_array_ptr_t *arr);
#endif
+4 -4
View File
@@ -26,7 +26,7 @@ const char *u_utf8_wind_n(const char *s, int n) {
return _s;
}
int64_t u_utf8_convert_to_wide(const char *utf8_str,
int32_t u_utf8_convert_to_wide(const char *utf8_str,
wchar_t **restrict wide_str,
size_t *restrict len) {
// Step 1: Convert UTF-8 (MBCS) to wchar_t (wide)
@@ -44,12 +44,12 @@ int64_t u_utf8_convert_to_wide(const char *utf8_str,
return 0;
}
int64_t u_utf8_curs_printw(WINDOW *win, int64_t *y, int64_t *x,
int32_t u_utf8_curs_printw(WINDOW *win, int32_t *y, int32_t *x,
const char *utf8_str, int max_len, bool multiline) {
wchar_t *wline = NULL;
size_t nsize = 0;
int64_t _x = *x;
int64_t _y = *y;
int32_t _x = *x;
int32_t _y = *y;
u_utf8_convert_to_wide(utf8_str, &wline, &nsize);
mvwaddnwstr(win, _y, _x, wline, max_len);
+2 -2
View File
@@ -7,8 +7,8 @@
const char *u_utf8_wind_n(const char *s, int n);
size_t u_utf8_code_points_count(const char *s);
int64_t u_utf8_convert_to_wide(const char *utf8_str, wchar_t **restrict wide_str,
int32_t u_utf8_convert_to_wide(const char *utf8_str, wchar_t **restrict wide_str,
size_t *restrict len);
int64_t u_utf8_curs_printw(WINDOW *win, int64_t *y, int64_t *x, const char* utf8_str, int max_len, bool multiline);
int32_t u_utf8_curs_printw(WINDOW *win, int32_t *y, int32_t *x, const char* utf8_str, int max_len, bool multiline);
#endif