[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo info/nodes.c info/session.c info/sessio...
From: |
Sergey Poznyakoff |
Subject: |
texinfo info/nodes.c info/session.c info/sessio... |
Date: |
Sat, 14 Jan 2012 17:58:32 +0000 |
CVSROOT: /cvsroot/texinfo
Module name: texinfo
Changes by: Sergey Poznyakoff <gray> 12/01/14 17:58:32
Modified files:
info : nodes.c session.c session.h indices.c
footnotes.c
. : ChangeLog
Log message:
Use literal matching when searching for xrefs or menu items.
* info/nodes.c (adjust_nodestart): Reset body_start.
* info/session.c (info_toggle_regexp): Minor change.
(info_menu_or_ref_item): Set cursor at the start of
the body if the search fails.
(info_search_in_node_internal): Take additional argument
indicating whether to use regexp matching. All uses changed.
(info_search_in_node): Likewise.
(info_target_search_node): Use additional argument to mask
use_regex flag. All uses changed.
(info_menu_or_ref_item): Mask out use_regex.
* info/session.h (info_search_in_node)
(info_target_search_node): Change prototypes.
* info/indices.c (info_next_index_match): Update.
* info/footnotes.c (make_footnotes_node): Update.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/nodes.c?cvsroot=texinfo&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/session.c?cvsroot=texinfo&r1=1.52&r2=1.53
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/session.h?cvsroot=texinfo&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/indices.c?cvsroot=texinfo&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/footnotes.c?cvsroot=texinfo&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/texinfo/ChangeLog?cvsroot=texinfo&r1=1.1303&r2=1.1304
Patches:
Index: info/nodes.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/nodes.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- info/nodes.c 18 Oct 2011 18:47:21 -0000 1.17
+++ info/nodes.c 14 Jan 2012 17:58:31 -0000 1.18
@@ -1,5 +1,5 @@
/* nodes.c -- how to get an Info file and node.
- $Id: nodes.c,v 1.17 2011/10/18 18:47:21 karl Exp $
+ $Id: nodes.c,v 1.18 2012/01/14 17:58:31 gray Exp $
Copyright (C) 1993, 1998, 1999, 2000, 2002, 2003, 2004, 2006, 2007,
2008, 2009, 2011 Free Software Foundation, Inc.
@@ -1259,6 +1259,7 @@
(strncmp (node->nodename, nodedef, offset) == 0))
{
node->contents = nodestart;
+ node_set_body_start (node);
return node_body.buffer + position;
}
}
@@ -1281,6 +1282,7 @@
(if we used a tag to get here, that is). Set the flag in NODE->flags. */
node->contents = node_body.buffer + position;
node->contents += skip_node_separator (node->contents);
+ node_set_body_start (node);
if (node->flags & N_HasTagsTable)
node->flags |= N_UpdateTags;
return node_body.buffer + position;
Index: info/session.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/session.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- info/session.c 18 Oct 2011 18:47:21 -0000 1.52
+++ info/session.c 14 Jan 2012 17:58:32 -0000 1.53
@@ -1,5 +1,5 @@
/* session.c -- user windowing interface to Info.
- $Id: session.c,v 1.52 2011/10/18 18:47:21 karl Exp $
+ $Id: session.c,v 1.53 2012/01/14 17:58:32 gray Exp $
Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
@@ -1995,7 +1995,7 @@
DECLARE_INFO_COMMAND (info_toggle_regexp,
_("Toggle the usage of regular expressions in searches"))
{
- use_regex = 1 - use_regex;
+ use_regex = !use_regex;
window_message_in_echo_area (use_regex
? _("Using regular expressions for searches.")
: _("Using literal strings for searches."));
@@ -2603,15 +2603,13 @@
else
start = 0;
- offset =
- info_target_search_node (window->node, entry->label, start);
+ offset = info_target_search_node (window->node, entry->label,
+ start, 0);
- if (offset != -1)
- {
- window->point = offset;
+ window->point = (offset == -1) ?
+ window->node->body_start : offset;
window_adjust_pagetop (window);
}
- }
if (entry->line_number > 0)
/* next_line starts at line 1? Anyway, the -1 makes it
@@ -3732,7 +3730,7 @@
static enum search_result
info_search_in_node_internal (char *string, NODE *node, long int start,
WINDOW *window, int dir, int case_sensitive,
- int match_nodename,
+ int match_nodename, int match_regexp,
long *poff, SEARCH_BINDING *resbnd)
{
SEARCH_BINDING binding;
@@ -3763,7 +3761,7 @@
binding.start = 0;
binding.end = strlen (node->nodename);
- result = (use_regex ?
+ result = (match_regexp ?
regexp_search (string, &binding, poff, resbnd):
search (string, &binding, poff));
if (result == search_success)
@@ -3788,7 +3786,7 @@
else if (binding.start < node->body_start)
binding.start = node->body_start;
- result = (use_regex ?
+ result = (match_regexp ?
regexp_search (string, &binding, poff, resbnd):
search (string, &binding, poff));
}
@@ -3806,11 +3804,13 @@
long
info_search_in_node (char *string, NODE *node, long int start,
- WINDOW *window, int dir, int case_sensitive)
+ WINDOW *window, int dir, int case_sensitive,
+ int match_regexp)
{
long offset;
if (info_search_in_node_internal (string, node, start,
window, dir, case_sensitive, 0,
+ match_regexp,
&offset, NULL) == search_success)
return offset;
return -1;
@@ -3820,7 +3820,8 @@
search at START. Return the absolute position of the match, or -1, if
no part of the string could be found. */
long
-info_target_search_node (NODE *node, char *string, long int start)
+info_target_search_node (NODE *node, char *string, long int start,
+ int use_regex_mask)
{
register int i;
long offset = 0;
@@ -3834,7 +3835,8 @@
while (i)
{
target[i] = '\0';
- offset = info_search_in_node (target, node, start, NULL, 1, 0);
+ offset = info_search_in_node (target, node, start, NULL, 1, 0,
+ use_regex & use_regex_mask);
if (offset != -1)
break;
@@ -3886,7 +3888,7 @@
result = info_search_in_node_internal
(string, window->node, start, window, dir,
- case_sensitive, 0, &ret, resbnd);
+ case_sensitive, 0, use_regex, &ret, resbnd);
switch (result)
{
@@ -4000,7 +4002,8 @@
result =
info_search_in_node_internal (string, node, start, window, dir,
- case_sensitive, 1, &ret, resbnd);
+ case_sensitive, 1, use_regex,
+ &ret, resbnd);
/* Did we find the string in this node? */
if (result == search_success)
@@ -4674,10 +4677,6 @@
long placement = -1;
long start = 0;
NODE *node = window->node;
- int save_use_regex = use_regex;
-
- /* Most of our keywords contain * characters; don't use regexes. */
- use_regex = 0;
if (dir < 0)
start = node->nodelen;
@@ -4686,8 +4685,8 @@
reference in the current node. Otherwise, the first menu or xref
found is moved to. */
- firstmenu = info_search_in_node
- (INFO_MENU_ENTRY_LABEL, node, start, NULL, dir, 0);
+ firstmenu = info_search_in_node (INFO_MENU_ENTRY_LABEL, node, start,
+ NULL, dir, 0, 0);
/* FIRSTMENU may point directly to the line defining the menu. Skip that
and go directly to the first item. */
@@ -4697,12 +4696,12 @@
char *text = node->contents + firstmenu;
if (strncmp (text, INFO_MENU_LABEL, strlen (INFO_MENU_LABEL)) == 0)
- firstmenu = info_search_in_node
- (INFO_MENU_ENTRY_LABEL, node, firstmenu + dir, NULL, dir, 0);
+ firstmenu = info_search_in_node (INFO_MENU_ENTRY_LABEL, node,
+ firstmenu + dir, NULL, dir, 0, 0);
}
firstxref =
- info_search_in_node (INFO_XREF_LABEL, node, start, NULL, dir, 0);
+ info_search_in_node (INFO_XREF_LABEL, node, start, NULL, dir, 0, 0);
#if defined (HANDLE_MAN_PAGES)
if ((firstxref == -1) && (node->flags & N_IsManPage))
@@ -4715,18 +4714,17 @@
{
if (!cursor_movement_scrolls_p)
info_error (msg_no_xref_node);
- use_regex = save_use_regex;
return cursor_movement_scrolls_p;
}
/* There is at least one cross reference or menu entry in this node.
Try hard to find the next available one. */
- nextmenu = info_search_in_node
- (INFO_MENU_ENTRY_LABEL, node, window->point + dir, NULL, dir, 0);
+ nextmenu = info_search_in_node (INFO_MENU_ENTRY_LABEL, node,
+ window->point + dir, NULL, dir, 0, 0);
- nextxref = info_search_in_node
- (INFO_XREF_LABEL, node, window->point + dir, NULL, dir, 0);
+ nextxref = info_search_in_node (INFO_XREF_LABEL, node,
+ window->point + dir, NULL, dir, 0, 0);
#if defined (HANDLE_MAN_PAGES)
if ((nextxref == -1) && (node->flags & N_IsManPage) && (firstxref != -1))
@@ -4739,13 +4737,10 @@
char *text = node->contents + nextmenu;
if (strncmp (text, INFO_MENU_LABEL, strlen (INFO_MENU_LABEL)) == 0)
- nextmenu = info_search_in_node
- (INFO_MENU_ENTRY_LABEL, node, nextmenu + dir, NULL, dir, 0);
+ nextmenu = info_search_in_node (INFO_MENU_ENTRY_LABEL, node,
+ nextmenu + dir, NULL, dir, 0, 0);
}
- /* No more searches, back to whatever the user wanted. */
- use_regex = save_use_regex;
-
/* If there is both a next menu entry, and a next xref entry, choose the
one which occurs first. Otherwise, select the one which actually
appears in this node following point. */
Index: info/session.h
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/session.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- info/session.h 18 Oct 2011 18:47:22 -0000 1.12
+++ info/session.h 14 Jan 2012 17:58:32 -0000 1.13
@@ -1,5 +1,5 @@
/* session.h -- Functions found in session.c.
- $Id: session.h,v 1.12 2011/10/18 18:47:22 karl Exp $
+ $Id: session.h,v 1.13 2012/01/14 17:58:32 gray Exp $
Copyright (C) 1993, 1998, 1999, 2001, 2002, 2004, 2007, 2011
Free Software Foundation, Inc.
@@ -86,9 +86,10 @@
extern void info_gather_typeahead (void);
extern FILE_BUFFER *file_buffer_of_window (WINDOW *window);
extern long info_search_in_node (char *string, NODE *node,
- long int start, WINDOW *window, int dir, int case_sensitive);
+ long int start, WINDOW *window, int dir, int case_sensitive,
+ int use_regexp);
extern long info_target_search_node (NODE *node, char *string,
- long int start);
+ long int start, int use_regexp_mask);
extern void info_select_reference (WINDOW *window, REFERENCE *entry);
extern int info_any_buffered_input_p (void);
extern void print_node (NODE *node);
Index: info/indices.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/indices.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- info/indices.c 27 Dec 2011 20:27:22 -0000 1.18
+++ info/indices.c 14 Jan 2012 17:58:32 -0000 1.19
@@ -1,5 +1,5 @@
/* indices.c -- deal with an Info file index.
- $Id: indices.c,v 1.18 2011/12/27 20:27:22 gray Exp $
+ $Id: indices.c,v 1.19 2012/01/14 17:58:32 gray Exp $
Copyright (C) 1993, 1997, 1998, 1999, 2002, 2003, 2004, 2007, 2008, 2011
Free Software Foundation, Inc.
@@ -510,7 +510,7 @@
{
/* Try to find an occurence of LABEL in this node. */
long start = window->line_starts[1] - window->node->contents;
- loc = info_target_search_node (node, index_index[i]->label, start);
+ loc = info_target_search_node (node, index_index[i]->label, start, 1);
}
if (loc != -1)
Index: info/footnotes.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/footnotes.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- info/footnotes.c 18 Oct 2011 18:47:20 -0000 1.11
+++ info/footnotes.c 14 Jan 2012 17:58:32 -0000 1.12
@@ -1,5 +1,5 @@
/* footnotes.c -- Some functions for manipulating footnotes.
- $Id: footnotes.c,v 1.11 2011/10/18 18:47:20 karl Exp $
+ $Id: footnotes.c,v 1.12 2012/01/14 17:58:32 gray Exp $
Copyright (C) 1993, 1997, 1998, 1999, 2002, 2004, 2007, 2008, 2011
Free Software Foundation, Inc.
@@ -60,8 +60,7 @@
fn_node = node;
/* See if this node contains the magic footnote label. */
- fn_start =
- info_search_in_node (FOOTNOTE_LABEL, node, 0, NULL, 1, 0);
+ fn_start = info_search_in_node (FOOTNOTE_LABEL, node, 0, NULL, 1, 0, 0);
/* If it doesn't, check to see if it has an associated footnotes node. */
if (fn_start == -1)
Index: ChangeLog
===================================================================
RCS file: /cvsroot/texinfo/texinfo/ChangeLog,v
retrieving revision 1.1303
retrieving revision 1.1304
diff -u -b -r1.1303 -r1.1304
--- ChangeLog 13 Jan 2012 00:26:16 -0000 1.1303
+++ ChangeLog 14 Jan 2012 17:58:32 -0000 1.1304
@@ -1,3 +1,23 @@
+2012-01-14 Sergey Poznyakoff <address@hidden>
+
+ Use literal matching when searching for xrefs or menu items.
+
+ * info/nodes.c (adjust_nodestart): Reset body_start.
+ * info/session.c (info_toggle_regexp): Minor change.
+ (info_menu_or_ref_item): Set cursor at the start of
+ the body if the search fails.
+ (info_search_in_node_internal): Take additional argument
+ indicating whether to use regexp matching. All uses changed.
+ (info_search_in_node): Likewise.
+ (info_target_search_node): Use additional argument to mask
+ use_regex flag. All uses changed.
+ (info_menu_or_ref_item): Mask out use_regex.
+ * info/session.h (info_search_in_node)
+ (info_target_search_node): Change prototypes.
+
+ * info/indices.c (info_next_index_match): Update.
+ * info/footnotes.c (make_footnotes_node): Update.
+
2012-01-12 Karl Berry <address@hidden>
* util/texi2dvi (run_makeinfo): put the whole version check
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo info/nodes.c info/session.c info/sessio...,
Sergey Poznyakoff <=