From 914c5e5752eb30e1d1108fac2d94897e92b937bd Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 3 Oct 2023 11:55:00 -0700 Subject: libs/txt: fix width measurement without a \n Silly oversight preventing some haligns from working right if the string doesn't have a newline... uncovered while testing a new txt module's alignment settings. --- src/libs/txt/txt.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/libs') diff --git a/src/libs/txt/txt.c b/src/libs/txt/txt.c index f087aeb..883cd3e 100644 --- a/src/libs/txt/txt.c +++ b/src/libs/txt/txt.c @@ -43,6 +43,9 @@ static void measure_str(const char *str, int *res_width, int *res_height) str++; } + if (col > cols) + cols = col; + *res_height = 1 + rows * (ASCII_HEIGHT + 1); *res_width = 1 + cols * (ASCII_WIDTH + 1); } -- cgit v1.2.1