nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit c92b9be6cd0f2d4cddf8bff2995851571851bd75
parent eef7d1047adbfb36d8a4d0982b8a2881882688b2
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Fri, 23 Dec 2016 12:51:04 +0100

tweaks: rename three variables, to be more fitting

Diffstat:
Msrc/search.c | 4++--
Msrc/winio.c | 22++++++++++++----------
2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/search.c b/src/search.c @@ -1203,10 +1203,10 @@ void update_history(filestruct **h, const char *s) /* If the history is full, delete the oldest item (the one at the * head of the list), to make room for a new item at the end. */ if ((*hbot)->lineno == MAX_SEARCH_HISTORY + 1) { - filestruct *foo = *hage; + filestruct *oldest = *hage; *hage = (*hage)->next; - unlink_node(foo); + unlink_node(oldest); renumber(*hage); } diff --git a/src/winio.c b/src/winio.c @@ -2967,8 +2967,8 @@ void edit_redraw(filestruct *old_current) * if we've moved and changed text. */ void edit_refresh(void) { - filestruct *foo; - int nlines; + filestruct *line; + int row = 0; /* Figure out what maxrows should really be. */ compute_maxrows(); @@ -2983,20 +2983,22 @@ void edit_refresh(void) adjust_viewport((focusing || !ISSET(SMOOTH_SCROLL)) ? CENTERING : STATIONARY); } - foo = openfile->edittop; - #ifdef DEBUG fprintf(stderr, "edit-refresh: now edittop = %ld\n", (long)openfile->edittop->lineno); #endif - for (nlines = 0; nlines < editwinrows && foo != NULL; nlines++) { - nlines += update_line(foo, (foo == openfile->current) ? - openfile->current_x : 0); - foo = foo->next; + line = openfile->edittop; + + while (row < editwinrows && line != NULL) { + if (line == openfile->current) + row += update_line(line, openfile->current_x) + 1; + else + row += update_line(line, 0) + 1; + line = line->next; } - for (; nlines < editwinrows; nlines++) - blank_line(edit, nlines, 0, COLS); + while (row < editwinrows) + blank_line(edit, row++, 0, COLS); reset_cursor(); wnoutrefresh(edit);