From 7b9f793ba239ca14025c9892ee412b4433126d62 Mon Sep 17 00:00:00 2001 From: dennisschagt Date: Thu, 19 Mar 2020 20:17:41 +0100 Subject: [PATCH] Check if there is room left before printing '<' Fixes https://github.com/dennisschagt/stfl/issues/1 --- base.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/base.c b/base.c index 9adb254..479480a 100644 --- a/base.c +++ b/base.c @@ -750,9 +750,11 @@ unsigned int stfl_print_richtext(struct stfl_widget *w, WINDOW *win, unsigned in wmemcpy(stylename, p1 + 1, p2 - p1 - 1); stylename[p2 - p1 - 1] = L'\0'; if (wcscmp(stylename,L"")==0) { - mvwaddnwstr(win, y, x, L"<", 1); - retval += 1; - ++x; + if (end_col - x > 0) { + mvwaddnwstr(win, y, x, L"<", 1); + retval += 1; + ++x; + } } else if (wcscmp(stylename, L"/")==0) { stfl_style(win, style_normal); } else {