summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-10-03 11:55:00 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-10-03 11:55:00 -0700
commit914c5e5752eb30e1d1108fac2d94897e92b937bd (patch)
treeeb93a392df4c9cd13c01d873a591d947cced9e0a
parentc834a26416fc1a2d5b4c9e94e0bd2788020af3f2 (diff)
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.
-rw-r--r--src/libs/txt/txt.c3
1 files changed, 3 insertions, 0 deletions
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);
}
© All Rights Reserved