texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * info/indices.c (info_indices_of_file_buffer): C


From: Gavin D. Smith
Subject: branch master updated: * info/indices.c (info_indices_of_file_buffer): Check for N_IsIndex flag on index nodes. This has the effect that typing 'i<ret>' avoids taking you to a node with "Index" in the name that is not a real index, as long as there are other nodes with the index marker in them.
Date: Sun, 02 Apr 2023 11:59:46 -0400

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 6cc63cef15 * info/indices.c (info_indices_of_file_buffer): Check for 
N_IsIndex flag on index nodes.  This has the effect that typing 'i<ret>' avoids 
taking you to a node with "Index" in the name that is not a real index, as long 
as there are other nodes with the index marker in them.
6cc63cef15 is described below

commit 6cc63cef15a58e41d9094457b7fff8f106e3f1ad
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Apr 2 16:59:38 2023 +0100

    * info/indices.c (info_indices_of_file_buffer): Check for
    N_IsIndex flag on index nodes.  This has the effect that typing
    'i<ret>' avoids taking you to a node with "Index" in the name
    that is not a real index, as long as there are other nodes with
    the index marker in them.
---
 ChangeLog      |  8 ++++++++
 info/indices.c | 33 +++++++++++++++++++++------------
 2 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8514eb510e..c5d6317b45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-04-02  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * info/indices.c (info_indices_of_file_buffer): Check for
+       N_IsIndex flag on index nodes.  This has the effect that typing
+       'i<ret>' avoids taking you to a node with "Index" in the name
+       that is not a real index, as long as there are other nodes with
+       the index marker in them.
+
 2023-04-02  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/Convert/HTML.pm (%default_no_arg_commands_formatting):
diff --git a/info/indices.c b/info/indices.c
index 349775b1d2..f51061ee50 100644
--- a/info/indices.c
+++ b/info/indices.c
@@ -90,6 +90,22 @@ add_index_to_index_nodenames (REFERENCE **array, NODE *node)
                         index_nodenames_slots, 10);
 }
 
+static void
+clear_index_nodenames (void)
+{
+  int i;
+  if (!index_nodenames)
+    return;
+  for (i = 0; index_nodenames[i]; i++)
+    {
+      free (index_nodenames[i]->name);
+      free (index_nodenames[i]);
+    }
+
+  index_nodenames_index = 0;
+  index_nodenames[0] = NULL;
+}
+
 /* Find and concatenate the indices of FILE_BUFFER, saving the result in 
    INDEX_INDEX.  The indices are defined as the first node in the file 
    containing the word "Index" and any immediately following nodes whose names 
@@ -127,17 +143,7 @@ info_indices_of_file_buffer (FILE_BUFFER *file_buffer)
   initial_index_filename = NULL;
   initial_index_nodename = NULL;
 
-  if (index_nodenames)
-    {
-      for (i = 0; index_nodenames[i]; i++)
-        {
-          free (index_nodenames[i]->name);
-          free (index_nodenames[i]);
-        }
-
-      index_nodenames_index = 0;
-      index_nodenames[0] = NULL;
-    }
+  clear_index_nodenames ();
 
   /* Grovel the names of the nodes found in this file. */
   if (file_buffer->tags)
@@ -157,11 +163,14 @@ info_indices_of_file_buffer (FILE_BUFFER *file_buffer)
               if (!node)
                 continue;
 
-              if (!initial_index_filename)
+              if ((node->flags & N_IsIndex) && !initial_index_filename)
                 {
                   /* Remember the filename and nodename of this index. */
                   initial_index_filename = xstrdup (file_buffer->filename);
                   initial_index_nodename = xstrdup (tag->nodename);
+
+                  /* Clear list in case earlier node had "Index" in name. */
+                  clear_index_nodenames ();
                 }
 
               menu = node->references;



reply via email to

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