Fixed an issue with wrapping text incorrectly

modified:   src/nms.c
This commit is contained in:
Brian Barto 2016-05-12 17:15:19 -04:00
parent 2e47b10a82
commit 5b1cf2c362
1 changed files with 9 additions and 4 deletions

View File

@ -106,10 +106,15 @@ char nms_exec(NmsArgs *args) {
if (c == NEWLINE) { if (c == NEWLINE) {
++y; ++y;
x = 0; x = 0;
} else if (c == TAB && x + TAB_SIZE <= termSizeCols) { } else if (c == TAB) {
x += TAB_SIZE; if (x + TAB_SIZE < termSizeCols)
x += TAB_SIZE;
else {
++y;
x = 0;
}
} else if (isspace(c)) { } else if (isspace(c)) {
if (++x > termSizeCols) { if (++x >= termSizeCols) {
++y; ++y;
x = 0; x = 0;
} }
@ -169,7 +174,7 @@ char nms_exec(NmsArgs *args) {
list_pointer->s2_time = r_time > 1000 ? r_time_s : 0; list_pointer->s2_time = r_time > 1000 ? r_time_s : 0;
list_pointer->next = NULL; list_pointer->next = NULL;
if (++x > termSizeCols) { if (++x >= termSizeCols) {
++y; ++y;
x = 0; x = 0;
} }