diff options
author | Benji Dial <benji6283@gmail.com> | 2021-02-17 00:13:06 -0500 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2021-02-17 00:13:06 -0500 |
commit | 642c3c69a69220170e2f68c2bf6c898e6cb5b20b (patch) | |
tree | 853c4f59c859912f73ede4ab36d89d2b3e9ed0f0 /src/user/mkpopup | |
parent | be05b9b23f988f934af2fd49976fd97c22dfc19a (diff) | |
download | portland-os-642c3c69a69220170e2f68c2bf6c898e6cb5b20b.tar.gz |
win+space, mkpopup
Diffstat (limited to 'src/user/mkpopup')
-rw-r--r-- | src/user/mkpopup/main.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/user/mkpopup/main.c b/src/user/mkpopup/main.c new file mode 100644 index 0000000..5b56889 --- /dev/null +++ b/src/user/mkpopup/main.c @@ -0,0 +1,36 @@ +#include <popups/info.h> + +#include <knob/heap.h> + +#include <stdbool.h> +#include <stdint.h> + +void main(const char *text) { + uint32_t required_new_length = 0; + bool needs_new = false; + for (const char *c = text; c[0]; ++c) { + ++required_new_length; + if ((c[0] == '\\') && (c[1] == 'n')) { + ++c; + needs_new = true; + } + } + + if (needs_new) { + char *new_text = get_block(required_new_length); + const char *ci; + char *co; + for (ci = text, co = new_text; *ci; ++ci, ++co) + if ((ci[0] == '\\') && (ci[1] == 'n')) { + *co = '\n'; + ++ci; + } + else + *co = *ci; + text = new_text; + } + + struct popup p; + info_popup(&p, text, 0x10, 0x07); + make_modal(&p); +}
\ No newline at end of file |