From 5b1cf2c3623985a9d2169d1dc1d14561e54e336a Mon Sep 17 00:00:00 2001 From: Brian Barto Date: Thu, 12 May 2016 17:15:19 -0400 Subject: [PATCH] Fixed an issue with wrapping text incorrectly modified: src/nms.c --- src/nms.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/nms.c b/src/nms.c index 80177cf..ed7b27b 100644 --- a/src/nms.c +++ b/src/nms.c @@ -106,10 +106,15 @@ char nms_exec(NmsArgs *args) { if (c == NEWLINE) { ++y; x = 0; - } else if (c == TAB && x + TAB_SIZE <= termSizeCols) { - x += TAB_SIZE; + } else if (c == TAB) { + if (x + TAB_SIZE < termSizeCols) + x += TAB_SIZE; + else { + ++y; + x = 0; + } } else if (isspace(c)) { - if (++x > termSizeCols) { + if (++x >= termSizeCols) { ++y; x = 0; } @@ -169,7 +174,7 @@ char nms_exec(NmsArgs *args) { list_pointer->s2_time = r_time > 1000 ? r_time_s : 0; list_pointer->next = NULL; - if (++x > termSizeCols) { + if (++x >= termSizeCols) { ++y; x = 0; }