]> git.wh0rd.org Git - nano.git/commitdiff
in do_gotolinecolumn(), start the search for a line from fileage instead
authorDavid Lawrence Ramsey <pooka109@gmail.com>
Tue, 17 May 2005 22:01:55 +0000 (22:01 +0000)
committerDavid Lawrence Ramsey <pooka109@gmail.com>
Tue, 17 May 2005 22:01:55 +0000 (22:01 +0000)
of current (again)

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2526 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/search.c

index e79f6584861660a758b7e92a621e7278bedc59fc..83091795923c49015f9ed146b51e5410409c842b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -65,6 +65,8 @@ CVS code -
   do_gotoline()
        - Properly show an error message if we try to go to line 0,
          since the first line in the file is 1. (DLR)
+       - Start the search for a line from fileage instead of current
+         (again). (DLR)
 - utils.c:
   num_of_digits()
        - Use a size_t instead of an int, and rename to digits(). (DLR)
index 3b3f6fc59f82bbe42c457d9f44e3634dcd148ad3..b6eaa25fbe5f36d9109c754ec18b6fbfdbe600a8 100644 (file)
@@ -1016,15 +1016,8 @@ void do_gotolinecolumn(int line, ssize_t column, bool use_answer, bool
            column = 0;
     }
 
-    if (current->lineno > line) {
-       for (; current->prev != NULL && current->lineno > line;
-               current = current->prev)
-           ;
-    } else {
-       for (; current->next != NULL && current->lineno < line;
-               current = current->next)
-           ;
-    }
+    for (current = fileage; current->next != NULL && line > 1; line--)
+       current = current->next;
 
     current_x = actual_x(current->data, column);
     placewewant = column;