summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-08-18 11:18:01 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-08-18 11:18:01 +0200
commitd4d819a7d8753e9078ec6d47ff78b493cc4f97fd (patch)
tree38a8dd73fd48456e531f3d3baf8923255a766767
parentfee966abf48a84814b7b50ccb8c0dd118d65f30f (diff)
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.
-rw-r--r--src/imlib.c4
1 files changed, 3 insertions, 1 deletions
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,