On 27/09/2022 8.20 pm, Charles Reilly wrote:
On 27/09/2022 6.58 pm, Gavin Smith wrote:
On Tue, Sep 27, 2022 at 06:07:08PM +0100, Charles Reilly wrote:
Hi,
Using info I have had some issues with finding the first entry in the
index.
For example, try running "info gzip". The first entry in the concept
index
for gzip is "bugs". Some example searches:
ibugs - Succeeds
ibu - No entries containing 'bu'.
Ibugs - No entries containing 'bugs'.
Ibu - No entries containing 'bu'.
It seems that the index-search only finds the first entry if it is an
exact
match. The virtual-index never finds the first entry.
Four similar tests for the second index entry, "concatenated files", all
succeed.
I'm using info version 6.7. A similar bug was reported previously:
https://lists.gnu.org/archive/html/bug-texinfo/2010-07/msg00015.html
A bug like this was fixed in March 2022. This was reported here:
https://lists.gnu.org/archive/html/bug-texinfo/2022-02/msg00105.html
and fixed on 2022-03-09. It was a different issue that was reported
in 2010.
Thank you, I missed that. I've built the latest source from savannah
and tried again. Now I get:
ibugs - Succeeds
ibu - Succeeds
Ibugs - No index entries containing 'bugs'.
Ibu - Succeeds
Everything works except a virtual index with an exact match on the first
index entry.
There is also still a slight weirdness with the index search. Normally
after a search with a single result, entering ',' for the next result
gives something like "No more index entries containing 'concat'". But
if the result was the first one in the index it gives "No index entries
containing 'bu'", without the "more". This is no great problem but it
does suggest something odd is going on.
A fix is attached.
From d1601d65ebe662f9097319fdded54f98934cccc9 Mon Sep 17 00:00:00 2001
From: Charles Reilly <[email protected]>
Date: Wed, 28 Sep 2022 16:31:13 +0100
Subject: [PATCH] Reliable index searches for first index item
---
info/indices.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/info/indices.c b/info/indices.c
index 5dfcf3091c..349775b1d2 100644
--- a/info/indices.c
+++ b/info/indices.c
@@ -33,7 +33,7 @@ int show_index_match = 1;
static REFERENCE **index_index = NULL;
/* The offset of the most recently selected index element. */
-static int index_offset = 0;
+static int index_offset = -1;
/* Whether we are doing initial index search. */
static int index_initial = 0;
@@ -264,7 +264,7 @@ DECLARE_INFO_COMMAND (info_index_search,
/* If the search failed, return the index offset to where it belongs. */
if (index_offset == old_offset)
- index_offset = 0;
+ index_offset = -1;
}
/* Return true if ENT->label matches "S( <[0-9]+>)?", where S stands
@@ -472,11 +472,11 @@ DECLARE_INFO_COMMAND (info_next_index_match,
/* If that failed, print an error. */
if (!result)
{
- info_error (index_offset > 0 ?
+ info_error (index_offset >= 0 ?
_("No more index entries containing '%s'") :
_("No index entries containing '%s'"),
index_search);
- index_offset = 0;
+ index_offset = -1;
return;
}
@@ -825,7 +825,7 @@ create_virtual_index (FILE_BUFFER *file_buffer, char
*index_search)
cnt = 0;
- index_offset = 0;
+ index_offset = -1;
index_initial = 0;
index_partial = 0;
while (1)
--
2.30.2