Removing a pointless condition, and making use of an existing intermediary

variable for a little optimization.

Openfile can never be NULL -- it should have been called openbuffer, and
before we start fiddling with the cursor, we will always have an open buffer.
Edittop might be NULL, but that's okay.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5763 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2016-03-23 19:48:44 +00:00
parent 3660c62bc0
commit 6fc70cc474
2 changed files with 4 additions and 10 deletions

View File

@ -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 <thomasr@fantasymail.de>
* configure.ac, src/*.c: Check for the existence of the REG_ENHANCED

View File

@ -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