From 980e334e3711e0f663efd893da1bcc3f23ee2a5c Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensberg@justemail.net> Date: Fri, 13 Jan 2017 19:11:11 +0100 Subject: [PATCH] tweaks: rearrange some code to separate softwrap and normal mode more (Ignore the indentation for the moment.) --- src/winio.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/winio.c b/src/winio.c index b60e4362..ad37b3ac 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2688,11 +2688,13 @@ int update_line(filestruct *fileptr, size_t index) if (row < 0 || row >= editwinrows) return 0; +#ifndef NANO_TINY + if (!ISSET(SOFTWRAP)) { +#endif /* First, blank out the row. */ blank_row(edit, row, 0, COLS); /* Next, find out from which column to start displaying the line. */ - if (!ISSET(SOFTWRAP)) from_col = get_page_start(strnlenpt(fileptr->data, index)); /* Expand the line, replacing tabs with spaces, and control @@ -2703,9 +2705,6 @@ int update_line(filestruct *fileptr, size_t index) edit_draw(fileptr, converted, row, from_col); free(converted); -#ifndef NANO_TINY - if (!ISSET(SOFTWRAP)) { -#endif if (from_col > 0) mvwaddch(edit, row, margin, '$'); if (strlenpt(fileptr->data) > from_col + editwincols) @@ -2714,25 +2713,27 @@ int update_line(filestruct *fileptr, size_t index) } else { size_t full_length = strlenpt(fileptr->data); - for (from_col += editwincols; from_col <= full_length && - row < editwinrows - 1; from_col += editwincols) { + for (from_col = 0; from_col <= full_length && + row < editwinrows; from_col += editwincols) { /* First, blank out the row. */ - blank_row(edit, ++row, 0, COLS); + blank_row(edit, row, 0, COLS); /* Expand the line, replacing tabs with spaces, and control * characters with their displayed forms. */ converted = display_string(fileptr->data, from_col, editwincols, TRUE); /* Draw the line. */ - edit_draw(fileptr, converted, row, from_col); + edit_draw(fileptr, converted, row++, from_col); free(converted); extra_rows++; } + + return --extra_rows; } #endif - return extra_rows; + return 0; } /* Check whether old_column and new_column are on different "pages" (or that -- GitLab