From 8b455d4ced2d3c36ec064ee8d8c17b303a7d455b Mon Sep 17 00:00:00 2001 From: Samuel Dudik Date: Sun, 23 Aug 2020 13:35:19 +0200 Subject: [PATCH] Minor refactoring before first release --- Makefile | 2 +- config.def.h | 2 +- herbe.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 240f4fa..3225e36 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CFLAGS = -Wall -Wextra -pedantic -lX11 -lXft -I/usr/include/freetype2 -lm -pthread +CFLAGS = -Wall -Wextra -pedantic -lX11 -lXft -I/usr/include/freetype2 -pthread PREFIX ?= /usr/local CC ?= cc diff --git a/config.def.h b/config.def.h index a30c1e4..86b7e76 100644 --- a/config.def.h +++ b/config.def.h @@ -1,7 +1,7 @@ static const char *background_color = "#3e3e3e"; static const char *border_color = "#ececec"; static const char *font_color = "#ececec"; -static const char *font_pattern = "Inconsolata:style=Medium:size=12"; +static const char *font_pattern = "monospace:size=10"; static const unsigned line_spacing = 5; static const unsigned int padding = 15; diff --git a/herbe.c b/herbe.c index 05b21b1..51d3990 100644 --- a/herbe.c +++ b/herbe.c @@ -56,7 +56,7 @@ int get_max_len(char *string, XftFont *font, int max_text_width) return ++i; } - if (info.width < max_text_width) + if (info.width <= max_text_width) return eol; int temp = eol; @@ -133,13 +133,13 @@ int main(int argc, char *argv[]) for (int i = 1; i < argc; i++) { - for (unsigned int eol = get_max_len(argv[i], font, max_text_width); eol <= strlen(argv[i]) && eol; argv[i] += eol, num_of_lines++, eol = get_max_len(argv[i], font, max_text_width)) + for (unsigned int eol = get_max_len(argv[i], font, max_text_width); eol; argv[i] += eol, num_of_lines++, eol = get_max_len(argv[i], font, max_text_width)) { if (lines_size <= num_of_lines) { lines = realloc(lines, (lines_size += 5) * sizeof(char *)); if (!lines) - die("malloc failed"); + die("realloc failed"); } lines[num_of_lines] = malloc((eol + 1) * sizeof(char));