[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6209] following menus to take precedence over index lookup
From: |
Gavin D. Smith |
Subject: |
[6209] following menus to take precedence over index lookup |
Date: |
Tue, 07 Apr 2015 10:52:28 +0000 |
Revision: 6209
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6209
Author: gavin
Date: 2015-04-07 10:52:27 +0000 (Tue, 07 Apr 2015)
Log Message:
-----------
following menus to take precedence over index lookup
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/indices.c
trunk/info/indices.h
trunk/info/info.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-04-07 10:14:19 UTC (rev 6208)
+++ trunk/ChangeLog 2015-04-07 10:52:27 UTC (rev 6209)
@@ -1,5 +1,11 @@
2015-04-07 Gavin Smith <address@hidden>
+ * info.c (add_initial_nodes): Follow menus inexactly before
+ checking indices sloppily. Reported by Benno Schulenberg.
+ * info/indices.c (look_in_indices): Arguments changed.
+
+2015-04-07 Gavin Smith <address@hidden>
+
* info/session.c (forward_move_node_structure) <Up and Next>,
(backward_move_node_structure) <Prev and down>: Clean up window
history so to add only one node in history. Report from Benno
Modified: trunk/info/indices.c
===================================================================
--- trunk/info/indices.c 2015-04-07 10:14:19 UTC (rev 6208)
+++ trunk/info/indices.c 2015-04-07 10:52:27 UTC (rev 6209)
@@ -488,12 +488,13 @@
info_select_reference (window, result);
}
-/* Look for the best match of STRING in the indices of FB. Return null if no
- match is found. Return value should not be freed or modified. This
differs
- from the behaviour of next_index_match in that only _initial_ substrings
are
+/* Look for the best match of STRING in the indices of FB. If SLOPPY, allow
+ case-insensitive initial substrings to match. Return null if no match is
+ found. Return value should not be freed or modified. This differs from
the
+ behaviour of next_index_match in that only _initial_ substrings are
considered. */
REFERENCE *
-look_in_indices (FILE_BUFFER *fb, char *string)
+look_in_indices (FILE_BUFFER *fb, char *string, int sloppy)
{
REFERENCE **index_ptr;
REFERENCE *nearest = 0;
@@ -515,7 +516,7 @@
break;
}
/* Case-insensitive initial substring. */
- if (!nearest && !mbsncasecmp (string, (*index_ptr)->label,
+ if (sloppy && !nearest && !mbsncasecmp (string, (*index_ptr)->label,
mbslen (string)))
{
nearest = *index_ptr;
Modified: trunk/info/indices.h
===================================================================
--- trunk/info/indices.h 2015-04-07 10:14:19 UTC (rev 6208)
+++ trunk/info/indices.h 2015-04-07 10:52:27 UTC (rev 6209)
@@ -34,7 +34,7 @@
void next_index_match (FILE_BUFFER *fb, char *string, int offset, int dir,
REFERENCE **result, int *found_offset, int *match_offset);
void report_index_match (int i, int match_offset);
-REFERENCE *look_in_indices (FILE_BUFFER *fb, char *string);
+REFERENCE *look_in_indices (FILE_BUFFER *fb, char *string, int sloppy);
#define APROPOS_NONE \
N_("No available info files have '%s' in their indices.")
Modified: trunk/info/info.c
===================================================================
--- trunk/info/info.c 2015-04-07 10:14:19 UTC (rev 6208)
+++ trunk/info/info.c 2015-04-07 10:52:27 UTC (rev 6209)
@@ -442,33 +442,33 @@
else if (argc == 1 && argv[0])
{
FILE_BUFFER *fb;
- REFERENCE *nearest;
+ REFERENCE *match;
debug (3, ("looking in indices"));
fb = info_find_file (ref_list[0]->filename);
if (fb)
{
- nearest = look_in_indices (fb, argv[0]);
- if (nearest)
+ match = look_in_indices (fb, argv[0], 0);
+ if (match)
{
argv += argc; argc = 0;
free (*error); *error = 0;
info_reference_free (ref_list[0]);
- ref_list[0] = info_copy_reference (nearest);
+ ref_list[0] = info_copy_reference (match);
}
}
}
- /* If there are arguments remaining, follow menus
- inexactly. */
+ /* If there are arguments remaining, follow menus inexactly. */
if (argc != 0)
{
initial_node = info_get_node_with_defaults (ref_list[0]->filename,
ref_list[0]->nodename,
0);
+ free (*error); *error = 0;
node_via_menus = info_follow_menus (initial_node, argv, error, 0);
- if (node_via_menus)
+ if (node_via_menus && (argc >= 2 || !*error))
{
argv += argc; argc = 0;
@@ -478,6 +478,29 @@
free_history_node (node_via_menus);
}
}
+
+ /* If still no nodes found, and there is exactly one argument remaining,
+ look in indices sloppily. */
+ if (argc == 1)
+ {
+ FILE_BUFFER *fb;
+ REFERENCE *nearest;
+
+ debug (3, ("looking in indices sloppily"));
+ fb = info_find_file (ref_list[0]->filename);
+ if (fb)
+ {
+ nearest = look_in_indices (fb, argv[0], 1);
+ if (nearest)
+ {
+ argv += argc; argc = 0;
+ free (*error); *error = 0;
+
+ info_reference_free (ref_list[0]);
+ ref_list[0] = info_copy_reference (nearest);
+ }
+ }
+ }
}
return;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6209] following menus to take precedence over index lookup,
Gavin D. Smith <=