Tidying up and renaming a variable.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5764 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2016-03-23 20:04:33 +00:00
parent 6fc70cc474
commit 344fe558b6
2 changed files with 10 additions and 7 deletions

View File

@ -6,6 +6,7 @@
* src/search.c (findnextstr): Poll the keyboard once per second. * src/search.c (findnextstr): Poll the keyboard once per second.
* src/winio.c (reset_cursor): Remove a pointless condition, and make * src/winio.c (reset_cursor): Remove a pointless condition, and make
use of an existing intermediary variable. use of an existing intermediary variable.
* src/winio.c (reset_cursor): Tidy up and rename a variable.
2016-03-22 Thomas Rosenau <thomasr@fantasymail.de> 2016-03-22 Thomas Rosenau <thomasr@fantasymail.de>
* configure.ac, src/*.c: Check for the existence of the REG_ENHANCED * configure.ac, src/*.c: Check for the existence of the REG_ENHANCED

View File

@ -2270,28 +2270,30 @@ void onekey(const char *keystroke, const char *desc, size_t len)
} }
} }
/* Reset current_y, based on the position of current, and put the cursor /* Redetermine current_y from the position of current relative to edittop,
* in the edit window at (current_y, current_x). */ * and put the cursor in the edit window at (current_y, current_x). */
void reset_cursor(void) void reset_cursor(void)
{ {
size_t xpt = xplustabs(); size_t xpt = xplustabs();
#ifndef NANO_TINY #ifndef NANO_TINY
if (ISSET(SOFTWRAP)) { if (ISSET(SOFTWRAP)) {
filestruct *tmp; filestruct *line = openfile->edittop;
openfile->current_y = 0; openfile->current_y = 0;
for (tmp = openfile->edittop; tmp && tmp != openfile->current; tmp = tmp->next) while (line != NULL && line != openfile->current) {
openfile->current_y += (strlenpt(tmp->data) / COLS) + 1; openfile->current_y += strlenpt(line->data) / COLS + 1;
line = line->next;
}
openfile->current_y += xpt / COLS; openfile->current_y += xpt / COLS;
if (openfile->current_y < editwinrows) if (openfile->current_y < editwinrows)
wmove(edit, openfile->current_y, xpt % COLS); wmove(edit, openfile->current_y, xpt % COLS);
} else } else
#endif #endif
{ {
openfile->current_y = openfile->current->lineno - openfile->current_y = openfile->current->lineno -
openfile->edittop->lineno; openfile->edittop->lineno;
if (openfile->current_y < editwinrows) if (openfile->current_y < editwinrows)
wmove(edit, openfile->current_y, xpt - get_page_start(xpt)); wmove(edit, openfile->current_y, xpt - get_page_start(xpt));