]> git.wh0rd.org Git - nano.git/commitdiff
Not calculating the line length twice.
authorBenno Schulenberg <bensberg@justemail.net>
Tue, 27 Oct 2015 16:57:32 +0000 (16:57 +0000)
committerBenno Schulenberg <bensberg@justemail.net>
Tue, 27 Oct 2015 16:57:32 +0000 (16:57 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5374 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/move.c

index a92ddb0c89fb8b629db6ff1705f4389799def588..9c19c97569b060f7a569650b7e73010698b7ff83 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 2015-10-27  Benno Schulenberg  <bensberg@justemail.net>
        * src/move.c (do_next_word): Rewrite this function to use the same
        logic as do_prev_word(), reducing its number of lines to half.
+       * src/move.c (do_down): Don't calculate the line length twice.  And
+       in the bargain avoid a warning about comparison of signed/unsigned.
 
 2015-09-05  Benno Schulenberg  <bensberg@justemail.net>
        * src/winio.c (display_string, edit_draw): Force a redraw of a line
index f8d53405fe700ba2793bfc648894457a44f2d4a2..9735bf53ce6dfbfb588e66926355fa4748079368 100644 (file)
@@ -478,11 +478,11 @@ void do_down(
        topline = openfile->edittop;
        /* Reduce the amount when there are overlong lines at the top. */
        for (enough = 1; enough < amount; enough++) {
-           if (amount <= strlenpt(topline->data) / COLS) {
+           amount -= strlenpt(topline->data) / COLS;
+           if (amount <= 0) {
                amount = enough;
                break;
            }
-           amount -= strlenpt(topline->data) / COLS;
            topline = topline->next;
        }
     }