From d1601d65ebe662f9097319fdded54f98934cccc9 Mon Sep 17 00:00:00 2001 From: Charles Reilly 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