From d4d819a7d8753e9078ec6d47ff78b493cc4f97fd Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 18 Aug 2011 11:18:01 +0200 Subject: imlib.c: feh_draw_info: Only kill a line's last character if it's a newline feh_draw_info used to unconditionally swallow the last character of a line, assuming that it must be a newline. However, the very last line of a program's output may not end in a newline, in which case its last output character was omitted. --- src/imlib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/imlib.c b/src/imlib.c index e27db57..d12852c 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -562,7 +562,9 @@ void feh_draw_info(winwidget w) } else { while ((no_lines < 20) && fgets(info_buf, 256, info_pipe)) { - info_buf[strlen(info_buf)-1] = '\0'; + if (info_buf[strlen(info_buf)-1] == '\n') + info_buf[strlen(info_buf)-1] = '\0'; + gib_imlib_text_draw(im, fn, NULL, 2, (no_lines*th)+2, info_buf, IMLIB_TEXT_TO_RIGHT, 0, 0, 0, 255); gib_imlib_text_draw(im, fn, NULL, 1, (no_lines*th)+1, info_buf, -- cgit v1.2.3