]> git.wh0rd.org Git - nano.git/commitdiff
Eliding an unneeded variable and adjusting some wrappings and whitespace.
authorBenno Schulenberg <bensberg@justemail.net>
Thu, 14 Jan 2016 13:41:45 +0000 (13:41 +0000)
committerBenno Schulenberg <bensberg@justemail.net>
Thu, 14 Jan 2016 13:41:45 +0000 (13:41 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5559 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/winio.c

index e2df47ee8e1a777a80161a90ec32acd52e3bd25f..d255ddad838e0e81821faf5ca9b907e5671a49a4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
        * doc/nanorc.sample.in: Remove a reference to an obsolete file.
        Reported by Mike Frysinger.
        * src/winio.c (edit_redraw): Delete an 'if' that is always FALSE.
+       * src/winio.c (edit_redraw): Elide an unneeded variable and adjust
+       some wrappings and whitespace.
 
 2016-01-13  Benno Schulenberg  <bensberg@justemail.net>
        * src/files.c (save_poshistory): Reduce the indentation.
index 985fe087f1c33b27fd1bbda80430a6d0bf996023..5e2c73e661413cd5900ca98f8a8c3be911eaa795 100644 (file)
@@ -2977,10 +2977,9 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
     /* If either old_current or current is offscreen, scroll the edit
      * window until it's onscreen and get out. */
     if (old_current->lineno < openfile->edittop->lineno ||
-       old_current->lineno >= openfile->edittop->lineno +
-       maxrows || openfile->current->lineno <
-       openfile->edittop->lineno || openfile->current->lineno >=
-       openfile->edittop->lineno + maxrows) {
+               old_current->lineno >= openfile->edittop->lineno + maxrows ||
+               openfile->current->lineno < openfile->edittop->lineno ||
+               openfile->current->lineno >= openfile->edittop->lineno + maxrows) {
 #ifdef DEBUG
        fprintf(stderr, "edit_redraw(): line %ld was offscreen, oldcurrent = %ld edittop = %ld",
                (long)openfile->current->lineno, (long)old_current->lineno, (long)openfile->edittop->lineno);
@@ -2992,20 +2991,19 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
         * whether we've scrolled up or down) of the edit window. */
        if (openfile->mark_set) {
            ssize_t old_lineno;
-           filestruct *old_edittop = openfile->edittop;
 
-               old_lineno = (old_edittop->lineno + maxrows <=
-                       openfile->filebot->lineno) ?
-                       old_edittop->lineno + editwinrows :
-                       openfile->filebot->lineno;
+           if (openfile->edittop->lineno + maxrows <= openfile->filebot->lineno)
+               old_lineno = openfile->edittop->lineno + editwinrows;
+           else
+               old_lineno = openfile->filebot->lineno;
 
            foo = old_current;
 
            while (foo->lineno != old_lineno) {
                update_line(foo, 0);
 
-               foo = (foo->lineno > old_lineno) ? foo->prev :
-                       foo->next;
+               foo = (foo->lineno > old_lineno) ?
+                       foo->prev : foo->next;
            }
        }
 #endif /* !NANO_TINY */