texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[7758] info fix search wrapping


From: gavinsmith0123
Subject: [7758] info fix search wrapping
Date: Wed, 26 Apr 2017 16:56:23 -0400 (EDT)

Revision: 7758
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7758
Author:   gavin
Date:     2017-04-26 16:56:23 -0400 (Wed, 26 Apr 2017)
Log Message:
-----------
info fix search wrapping

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/session.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2017-04-24 06:48:05 UTC (rev 7757)
+++ trunk/ChangeLog     2017-04-26 20:56:23 UTC (rev 7758)
@@ -1,3 +1,11 @@
+2017-04-26  Gavin Smith  <address@hidden>
+
+       * info/session.c (info_search_internal): Search starting node at 
+       most twice in order to be able to find matches before starting 
+       offset in starting node.  Otherwise searches do not wrap around 
+       the first and last nodes in a file if all the matches are in a 
+       single node.  Report from Benno Schulenberg.
+
 2017-04-24  Gavin Smith  <address@hidden>
 
        * util/tests/texi2dvi_empty_text.sh: Remove test, as it does not

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2017-04-24 06:48:05 UTC (rev 7757)
+++ trunk/info/session.c        2017-04-26 20:56:23 UTC (rev 7758)
@@ -4042,6 +4042,7 @@
   char *subfile_name = 0;
   TAG *tag;
   char *msg = 0;
+  int first_time = 1;
   
   /* If this node isn't part of a larger file, search this node only. */
   file_buffer = file_buffer_of_window (window);
@@ -4100,9 +4101,16 @@
 
       if (!search_other_nodes)
         break;
+
+      /* If we've searched our starting node twice, there are no matches.
+         Bail out.  (We searched the second time in case there were matches 
+         before the starting offset.) */
+      if (current_tag == starting_tag && !first_time)
+        break;
+      first_time = 0;
   
       /* Find the next tag that isn't an anchor.  */
-      for (i = current_tag + dir; i != starting_tag; i += dir)
+      for (i = current_tag + dir; ; i += dir)
         {
           if (i < 0)
             {
@@ -4120,9 +4128,6 @@
             break;
         }
 
-      /* If we got past our starting point, bail out.  */
-      if (i == starting_tag)
-        break;
       current_tag = i;
 
       /* Display message when searching a new subfile. */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]