From b8d4bb7003edeced1c593215730344c87d0f6ab7 Mon Sep 17 00:00:00 2001 From: Samuel Dudik Date: Sat, 1 Aug 2020 21:34:48 +0200 Subject: [PATCH] Add word wrap --- config.h | 2 +- herbe.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config.h b/config.h index bc99cd7..7251431 100644 --- a/config.h +++ b/config.h @@ -5,7 +5,7 @@ const static char *font_pattern = "Inconsolata:style=Medium:size=13"; const static unsigned line_spacing = 5; const static unsigned int padding = 15; -const static unsigned int width = 200; +const static unsigned int width = 400; const static unsigned int border_size = 2; const static unsigned int pos_x = 30; const static unsigned int pos_y = 50; diff --git a/herbe.c b/herbe.c index c05da39..e2e3b4b 100644 --- a/herbe.c +++ b/herbe.c @@ -89,6 +89,11 @@ int main(int argc, char *argv[]) break; } + while (body[eols[num_of_lines - 1] + eol] != ' ') + --eol; + + eol++; + remainder -= eol; if (eols_size < num_of_lines + 1) {