From 00737514abc1b4f246094781b2dbbd9e41003bd4 Mon Sep 17 00:00:00 2001 From: faissaloo Date: Sun, 28 Aug 2016 23:09:26 +0100 Subject: [PATCH 15/20] Bugfix for last character not showing when a page is full + formatting --- src/winio.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/winio.c b/src/winio.c index 9460cee..015deba 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2619,7 +2619,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int paintlen = actual_x(converted + index + margin, paintlen); wattron(edit, hilite_attribute); - mvwaddnstr(edit, line, x_start+margin, converted + index, paintlen); + mvwaddnstr(edit, line, x_start + margin, converted + index, paintlen); wattroff(edit, hilite_attribute); } } @@ -2671,9 +2671,9 @@ int update_line(filestruct *fileptr, size_t index) /* Expand the line, replacing tabs with spaces, and control * characters with their displayed forms. */ #ifdef NANO_TINY - converted = display_string(fileptr->data, page_start, COLS, TRUE); + converted = display_string(fileptr->data, page_start, COLS + 1, TRUE); #else - converted = display_string(fileptr->data, page_start, COLS, !ISSET(SOFTWRAP)); + converted = display_string(fileptr->data, page_start, COLS + 1, !ISSET(SOFTWRAP)); #ifdef DEBUG if (ISSET(SOFTWRAP) && strlen(converted) >= COLS - 2) fprintf(stderr, "update_line(): converted(1) line = %s\n", converted); @@ -2688,13 +2688,13 @@ int update_line(filestruct *fileptr, size_t index) if (!ISSET(SOFTWRAP)) { #endif if (page_start > 0) - mvwaddch(edit, line, margin-1, '$'); - if (strlenpt(fileptr->data) > page_start + COLS - margin - 1) - mvwaddch(edit, line, COLS-1, '$'); + mvwaddch(edit, line, margin - 1, '$'); + if (strlenpt(fileptr->data) > page_start + COLS - margin) + mvwaddch(edit, line, COLS - 1, '$'); #ifndef NANO_TINY } else { size_t full_length = strlenpt(fileptr->data); - for (index += COLS - margin; index <= full_length && line < editwinrows - 1; index += COLS-margin) { + for (index += COLS - margin; index <= full_length && line < editwinrows - 1; index += COLS - margin) { line++; #ifdef DEBUG fprintf(stderr, "update_line(): softwrap code, moving to %d index %lu\n", line, (unsigned long)index); -- 2.7.4