ui: fixes multiline print in file list

This commit is contained in:
2026-04-24 17:12:00 +03:00
parent ad33876c73
commit 3b35551fc0
2 changed files with 6 additions and 8 deletions
+4 -6
View File
@@ -45,21 +45,19 @@ int64_t u_utf8_convert_to_wide(const char *utf8_str,
} }
int64_t u_utf8_curs_printw(WINDOW *win, int64_t *y, int64_t *x, int64_t u_utf8_curs_printw(WINDOW *win, int64_t *y, int64_t *x,
const char *utf8_str, int max_len, bool multi_line) { const char *utf8_str, int max_len, bool multiline) {
wchar_t *wline = NULL; wchar_t *wline = NULL;
size_t nsize = 0; size_t nsize = 0;
int64_t _x = *x; int64_t _x = *x;
int64_t _y = *y; int64_t _y = *y;
u_utf8_convert_to_wide(utf8_str, &wline, &nsize); u_utf8_convert_to_wide(utf8_str, &wline, &nsize);
size_t s_rest = nsize;
mvwaddnwstr(win, _y, _x, wline, max_len); mvwaddnwstr(win, _y, _x, wline, max_len);
if (multi_line) { if (multiline) {
s_rest -= max_len;
for (int i = 1; s_rest > 0; s_rest -= max_len, i++) {
_y++; _y++;
for (int i = 1; max_len*i < nsize; i++) {
_x = *x; _x = *x;
mvwaddnwstr(win, _y, _x, wline + max_len*i, max_len); mvwaddnwstr(win, _y++, _x, wline + max_len*i, max_len);
} }
} }
+1 -1
View File
@@ -9,6 +9,6 @@ const char *u_utf8_wind_n(const char *s, int n);
size_t u_utf8_code_points_count(const char *s); 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, int64_t u_utf8_convert_to_wide(const char *utf8_str, wchar_t **restrict wide_str,
size_t *restrict len); 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 multi_line); int64_t u_utf8_curs_printw(WINDOW *win, int64_t *y, int64_t *x, const char* utf8_str, int max_len, bool multiline);
#endif #endif