diff --git a/ChangeLog b/ChangeLog index 231cbe4b..bc01ede1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ that was meant to do this. This fixes Savannah bug #47188. * src/search.c (findnextstr): Clean up and rename a variable. * src/search.c (findnextstr): Poll the keyboard once per second. + * src/winio.c (reset_cursor): Remove a pointless condition, and make + use of an existing intermediary variable. 2016-03-22 Thomas Rosenau * configure.ac, src/*.c: Check for the existence of the REG_ENHANCED diff --git a/src/winio.c b/src/winio.c index e8699445..c18ac537 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2274,15 +2274,7 @@ void onekey(const char *keystroke, const char *desc, size_t len) * in the edit window at (current_y, current_x). */ void reset_cursor(void) { - size_t xpt; - /* If we haven't opened any files yet, put the cursor in the top - * left corner of the edit window and get out. */ - if (openfile == NULL) { - wmove(edit, 0, 0); - return; - } - - xpt = xplustabs(); + size_t xpt = xplustabs(); #ifndef NANO_TINY if (ISSET(SOFTWRAP)) { @@ -2292,7 +2284,7 @@ void reset_cursor(void) for (tmp = openfile->edittop; tmp && tmp != openfile->current; tmp = tmp->next) openfile->current_y += (strlenpt(tmp->data) / COLS) + 1; - openfile->current_y += xplustabs() / COLS; + openfile->current_y += xpt / COLS; if (openfile->current_y < editwinrows) wmove(edit, openfile->current_y, xpt % COLS); } else