From f57e2eabe0a10c9732c83532e01654a499fb8dcf Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Mon, 21 Jun 2021 17:47:13 -0400 Subject: many, many changes; settings is broken --- src/user/mkpopup/main.cpp | 50 +++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) (limited to 'src/user/mkpopup') diff --git a/src/user/mkpopup/main.cpp b/src/user/mkpopup/main.cpp index 5e3310c..8b3746c 100644 --- a/src/user/mkpopup/main.cpp +++ b/src/user/mkpopup/main.cpp @@ -1,41 +1,35 @@ #include #include -#include #include -#include using namespace raleigh; -widget *make_line(const char *str) { - return new label(str); -} - void main(const char *text) { - dllist box_widgets; - - char *const data = strdup(text); - - char *this_string = data; - while (*this_string) { - char *i = this_string; - while (1) { - if (!i[0]) { - box_widgets.add_back(*make_line(this_string)); - this_string = i; - break; - } - if ((i[0] == '\\') && (i[1] == 'n')) { - i[0] = '\0'; - box_widgets.add_back(*make_line(this_string)); - this_string = i + 2; - break; - } - ++i; + char *unescaped = new char[strlen(text) + 1]; + char *ui = unescaped; + while (1) { + const uint32_t len = str_find_any(text, "\\"); + if (len) { + blockcpy(ui, text, len); + text += len; + ui += len; + } + if (!*text) + break; + if (text[1] == 'n') { + *(ui++) = '\n'; + text += 2; + } + else { + *(ui++) = '\\'; + ++text; } } + *ui = '\0'; - vbox box(box_widgets); - padding p(box, 4); + label l(unescaped); + delete[] unescaped; + padding p(l, 4); window w(p); w.show(); -- cgit v1.2.3