From c75dec06a2a1f3e8611fa5642ab86853d1c2d3f9 Mon Sep 17 00:00:00 2001 From: Miika Alikirri Date: Fri, 1 Sep 2023 21:30:05 +0300 Subject: [PATCH] drawer: % formatting is no longer needed --- src/drawer.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/drawer.c b/src/drawer.c index 9e57d3c..958cdbe 100644 --- a/src/drawer.c +++ b/src/drawer.c @@ -307,28 +307,10 @@ static int find_utfs(const char* src, size_t src_len) return utfs; } -static void escape_text(const char* src, char* target, size_t src_len) -{ - size_t srci = 0; - size_t targeti = 0; - for (; srci < src_len; srci++, targeti++) { - if (src[srci] == '%') { - target[targeti] = '%'; - target[++targeti] = '%'; - } else { - target[targeti] = src[srci]; - } - } - - target[targeti] = '\0'; -} - static void draw_to_drawer(drawer* drawer, const char* text) { - char escape_buf[256]; int utfs = find_utfs(text, strlen(text)); - escape_text(text, escape_buf, strlen(text)); - mvwprintw(drawer->window, drawer->current_y, drawer->current_x, "%s", escape_buf); + mvwprintw(drawer->window, drawer->current_y, drawer->current_x, "%s", text); drawer->current_x -= utfs; }