diff options
author | Benji Dial <benji6283@gmail.com> | 2021-06-21 17:47:13 -0400 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2021-06-21 17:47:13 -0400 |
commit | f57e2eabe0a10c9732c83532e01654a499fb8dcf (patch) | |
tree | cbf91a23fcdd65e0ea7ed55b0940ca7042d59bef /src/user/mkpopup/main.cpp | |
parent | 83835306d57461205a7bcfef9f4c3e06bc504006 (diff) | |
download | portland-os-f57e2eabe0a10c9732c83532e01654a499fb8dcf.tar.gz |
many, many changes; settings is broken
Diffstat (limited to 'src/user/mkpopup/main.cpp')
-rw-r--r-- | src/user/mkpopup/main.cpp | 50 |
1 files changed, 22 insertions, 28 deletions
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 <raleigh/w/padding.h> #include <raleigh/w/label.h> -#include <raleigh/w/vbox.h> #include <raleigh/window.h> -#include <knob/block.h> using namespace raleigh; -widget *make_line(const char *str) { - return new label(str); -} - void main(const char *text) { - dllist<widget &> 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(); |