Revert "attempt at puting komes on multiple lines"
Some checks are pending
/ sync-to-origin (push) Waiting to run

This reverts commit 50ef8d9fda39f6c0ecedde3e34665da1e027012c.
This commit is contained in:
PoliEcho 2025-04-06 16:32:13 +02:00
parent 50ef8d9fda
commit c61a354be8

View File

@ -2,7 +2,6 @@
#include "helper_funcs.h" #include "helper_funcs.h"
#include "memory.h" #include "memory.h"
#include <cstddef> #include <cstddef>
#include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <curses.h> #include <curses.h>
@ -42,27 +41,28 @@ void komens_page() {
ITEM **komens_items = new ITEM *[num_of_komens + 1]; ITEM **komens_items = new ITEM *[num_of_komens + 1];
komens_allocated.push_back({ITEM_ARRAY, komens_items, num_of_komens}); komens_allocated.push_back({ITEM_ARRAY, komens_items, num_of_komens});
char **komens_bufs = new char *[num_of_komens]; char **title_bufs = new char *[num_of_komens];
char title_buf[1500]; char **name_bufs = new char *[num_of_komens];
char name_buf[1500]; char tmp_buf[1500];
for (size_t i = 0; i < num_of_komens; i++) { for (size_t i = 0; i < num_of_komens; i++) {
wcstombs(title_buf, wcstombs(tmp_buf,
string_to_wstring( string_to_wstring(
resp_from_api["Messages"][i]["Title"].get<std::string>()) resp_from_api["Messages"][i]["Title"].get<std::string>())
.c_str(), .c_str(),
sizeof(title_buf)); sizeof(tmp_buf));
title_bufs[i] = new char[strlen(tmp_buf) + 1];
strlcpy(title_bufs[i], tmp_buf, strlen(tmp_buf));
wcstombs( wcstombs(
name_buf, tmp_buf,
string_to_wstring( string_to_wstring(
resp_from_api["Messages"][i]["Sender"]["Name"].get<std::string>()) resp_from_api["Messages"][i]["Sender"]["Name"].get<std::string>())
.c_str(), .c_str(),
sizeof(name_buf)); sizeof(tmp_buf));
komens_bufs[i] = new char[strlen(title_buf) + strlen(name_buf) + 2]; name_bufs[i] = new char[strlen(tmp_buf) + 1];
snprintf(komens_bufs[i], strlen(title_buf) + strlen(name_buf) + 1, "%s\n%s", strlcpy(name_bufs[i], tmp_buf, strlen(tmp_buf));
title_buf, name_buf);
komens_items[i] = new_item(komens_bufs[i], ""); komens_items[i] = new_item(title_bufs[i], name_bufs[i]);
} }
komens_items[num_of_komens] = nullptr; komens_items[num_of_komens] = nullptr;