[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5262] Skip the current screen when repeating searches ("{" and "}").
From: |
Sergey Poznyakoff |
Subject: |
[5262] Skip the current screen when repeating searches ("{" and "}"). |
Date: |
Sat, 08 Jun 2013 19:19:11 +0000 |
Revision: 5262
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5262
Author: gray
Date: 2013-06-08 19:19:11 +0000 (Sat, 08 Jun 2013)
Log Message:
-----------
Skip the current screen when repeating searches ("{" and "}").
* NEWS: Update.
* doc/info-stnd.texi: Document the -a (--all) option and
the search-skip-screen. Mention '}' and '{' commands when
discussing repeated searches.
* doc/version-stnd.texi: Update.
* doc/version.texi: Update.
* info/session.c (search_skip_screen_p): New variable.
(info_search_1): Take additional argument, supplying the
starting position for the search. All uses changed
(DFL_START): New define.
(info_search_next,info_search_previous): If search_skip_screen_p
is set, skip the lines displayed on the screen.
* info/variables.c (info_variables): New variable
"search-skip-screen".
* info/variables.h (min_search_length): New proto.
Modified Paths:
--------------
trunk/ChangeLog
trunk/NEWS
trunk/doc/info-stnd.texi
trunk/doc/version-stnd.texi
trunk/doc/version.texi
trunk/info/session.c
trunk/info/variables.c
trunk/info/variables.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2013-06-07 23:47:36 UTC (rev 5261)
+++ trunk/ChangeLog 2013-06-08 19:19:11 UTC (rev 5262)
@@ -1,3 +1,23 @@
+2013-06-08 Sergey Poznyakoff <address@hidden>
+
+ Skip the current screen when repeating searches.
+
+ * NEWS: Update.
+ * doc/info-stnd.texi: Document the -a (--all) option and
+ the search-skip-screen. Mention '}' and '{' commands when
+ discussing repeated searches.
+ * doc/version-stnd.texi: Update.
+ * doc/version.texi: Update.
+ * info/session.c (search_skip_screen_p): New variable.
+ (info_search_1): Take additional argument, supplying the
+ starting position for the search. All uses changed
+ (DFL_START): New define.
+ (info_search_next,info_search_previous): If search_skip_screen_p
+ is set, skip the lines displayed on the screen.
+ * info/variables.c (info_variables): New variable
+ "search-skip-screen".
+ * info/variables.h (min_search_length): New proto.
+
2013-06-07 Karl Berry <address@hidden>
* doc/texinfo.txi (Preparing for @TeX{}): texinfo.cnf
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2013-06-07 23:47:36 UTC (rev 5261)
+++ trunk/NEWS 2013-06-08 19:19:11 UTC (rev 5262)
@@ -26,13 +26,15 @@
* info
-New option -x (--debug) enables additional debugging output.
+ . new option -x (--debug) enables additional debugging output.
+ . new option -v (--variable) assigns a value to an info variable.
+ The syntax is the same as for many other GNU utilities: -v VARIABLE=VALUE
+ . new variable search-skip-screen controls the starting position for
+ repeated search commands ({ and }). When set to On, repeated
+ searches skip the lines displayed on the screen, i.e. forward searches
+ (}) start at the beginning of the next page, and backward searches
+ ({) start at the end of the previous page.
-New option -v (--variable) assigns a value to an info variable. The
-syntax is the same as for many other GNU utilities:
-
- -v VARIABLE=VALUE
-
5.1 (12 March 2013)
* texi2any:
Modified: trunk/doc/info-stnd.texi
===================================================================
--- trunk/doc/info-stnd.texi 2013-06-07 23:47:36 UTC (rev 5261)
+++ trunk/doc/info-stnd.texi 2013-06-08 19:19:11 UTC (rev 5262)
@@ -142,6 +142,26 @@
The program accepts the following options:
@table @code
address@hidden
address@hidden --all
address@hidden -a
+Find all files matching the given file or node name. There are three
+possible usage patterns. When this option is used together with the
address@hidden (@option{-w}) option, @command{info} prints the names
+of the files on the standard output and exits. If used
+together with the @option{--output} (@option{-o}) option, the contents
+of all matched files are dumped to the specified output file.
+
+Otherwise, an interactive session is initiated. If more than one file
+matches, you are presented a menu node, listing the matches and
+allowing you to select one of them. This menu node can be brought
+back anytime by pressing @kbd{C-x f}.
+
+Otherwise, @command{info} starts as usual.
+
+The @option{--index-search} and @option{--node} options cannot be used
+together with this option.
+
@anchor{--apropos}
@item address@hidden
@itemx -k @var{string}
@@ -1035,9 +1055,12 @@
of @var{N}, search for @var{N}th occurrence of the string. Negative
arguments search backwards.
address@hidden search}
@item @kbd{C-x @kbd{n}} (@code{search-next})
address@hidden @address@hidden
@itemx @kbd{n}, vi-like operation
@kindex C-x n
address@hidden @}
@kindex n, vi-like operation
@findex search-next
@cindex repeated search
@@ -1045,15 +1068,29 @@
direction, and with the same case-sensitivity option. With a numeric
argument of @var{N}, search for @var{N}th next occurrence.
+By default, the search starts at the position immediately following
+the cursor. However, if the variable @code{search-skip-screen}
+(@pxref{Variables, , search-skip-screen}) is set, it starts at the
+beginning of the next page, thereby skipping all lines displayed on
+the screen.
+
@item @kbd{C-x @kbd{N}} (@code{search-previous})
address@hidden @address@hidden
@itemx @kbd{N}, vi-like operation
@kindex C-x N
address@hidden @{
@kindex n, vi-like operation
@findex search-previous
Search for the same string used in the last search command, and with the
same case-sensitivity option, but in the reverse direction. With a
numeric argument of @var{N}, search for @var{N}th previous occurrence.
+By default, the search starts at the position immediately preceding
+the cursor. If the variable @code{search-skip-screen}
+(@pxref{Variables, , search-skip-screen}) is set, it starts at the
+end of the previous page, skipping all lines displayed on
+the screen.
+
@item @kbd{C-s} (@code{isearch-forward})
@kindex C-s
@findex isearch-forward
@@ -2061,6 +2098,17 @@
Setting this variable to 1 causes a kind of ``smooth scrolling'' which
some people prefer.
address@hidden search-skip-screen
address@hidden search-skip-screen
+Change the starting point of the repeated searches (@pxref{repeated
+search}). When set to @code{Off} (the default), repeated searches
+start at the position immediately following (when searching in forward
+direction), or immediately preceding (when searching backwards) the
+cursor. When set to @code{On} repeated searches skip the lines
+displayed on the screen. In other words, forward searches
+(@address@hidden) start at the beginning of the next page, and backward
+searches (@address@hidden) start at the end of the previous page.
+
@item show-index-match
@vindex show-index-match
When set to @code{On}, the portion of the matched search string is
Modified: trunk/doc/version-stnd.texi
===================================================================
--- trunk/doc/version-stnd.texi 2013-06-07 23:47:36 UTC (rev 5261)
+++ trunk/doc/version-stnd.texi 2013-06-08 19:19:11 UTC (rev 5262)
@@ -1,4 +1,4 @@
address@hidden UPDATED 13 April 2013
address@hidden UPDATED-MONTH April 2013
address@hidden UPDATED 8 June 2013
address@hidden UPDATED-MONTH June 2013
@set EDITION 5.1
@set VERSION 5.1
Modified: trunk/doc/version.texi
===================================================================
--- trunk/doc/version.texi 2013-06-07 23:47:36 UTC (rev 5261)
+++ trunk/doc/version.texi 2013-06-08 19:19:11 UTC (rev 5262)
@@ -1,4 +1,4 @@
address@hidden UPDATED 22 March 2013
address@hidden UPDATED-MONTH March 2013
address@hidden UPDATED 8 June 2013
address@hidden UPDATED-MONTH June 2013
@set EDITION 5.1
@set VERSION 5.1
Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c 2013-06-07 23:47:36 UTC (rev 5261)
+++ trunk/info/session.c 2013-06-08 19:19:11 UTC (rev 5262)
@@ -1108,6 +1108,8 @@
/* Controls whether scroll-behavior affects line movement commands */
int cursor_movement_scrolls_p = 1;
+int search_skip_screen_p = 0;
+
/* Choices for the scroll-last-node variable */
char *scroll_last_node_choices[] = {
"Stop", "Scroll", "Top", NULL
@@ -3719,7 +3721,11 @@
static void info_gc_file_buffers (void);
static void info_search_1 (WINDOW *window, int count,
- unsigned char key, int case_sensitive, int ask_for_string);
+ unsigned char key, int case_sensitive,
+ int ask_for_string, long start);
+#define DFL_START (-1) /* a special value for the START argument of
+ info_search_1, meaning to use the default
+ starting position */
static char *search_string = NULL;
static int search_string_size = 0;
@@ -4067,14 +4073,14 @@
{
last_search_direction = count > 0 ? 1 : -1;
last_search_case_sensitive = 1;
- info_search_1 (window, count, key, 1, 1);
+ info_search_1 (window, count, key, 1, 1, DFL_START);
}
DECLARE_INFO_COMMAND (info_search, _("Read a string and search for it"))
{
last_search_direction = count > 0 ? 1 : -1;
last_search_case_sensitive = 0;
- info_search_1 (window, count, key, 0, 1);
+ info_search_1 (window, count, key, 0, 1, DFL_START);
}
DECLARE_INFO_COMMAND (info_search_backward,
@@ -4082,17 +4088,38 @@
{
last_search_direction = count > 0 ? -1 : 1;
last_search_case_sensitive = 0;
- info_search_1 (window, -count, key, 0, 1);
+ info_search_1 (window, -count, key, 0, 1, DFL_START);
}
+/* Common entry point for the search functions. Arguments:
+ WINDOW The window to search in
+ COUNT The sign of this argument defines the search
+ direction (negative for searching backwards);
+ its absolute value gives number of repetitions.
+ CASE_SENSITIVE Whether the search is case-sensitive or not.
+ ASK_FOR_STRING When true, ask for the search string. Otherwise
+ use the previously supplied one (repeated search).
+ START Start position for the search. If DFL_START, use
+ the default start position (see info_search_internal
+ for details.
+*/
static void
info_search_1 (WINDOW *window, int count, unsigned char key,
- int case_sensitive, int ask_for_string)
+ int case_sensitive, int ask_for_string, long start)
{
char *line, *prompt;
int result, old_pagetop;
int direction;
+ SEARCH_BINDING bind, *bindp;
+ if (start == DFL_START)
+ bindp = NULL;
+ else
+ {
+ bind.start = start;
+ bindp = &bind;
+ }
+
if (count < 0)
{
direction = -1;
@@ -4138,8 +4165,9 @@
if (*line)
{
if (strlen (line) + 1 > (unsigned int) search_string_size)
- search_string = xrealloc
- (search_string, (search_string_size += 50 + strlen (line)));
+ search_string =
+ xrealloc (search_string,
+ (search_string_size += 50 + strlen (line)));
strcpy (search_string, line);
free (line);
@@ -4166,7 +4194,7 @@
for (result = 0; result == 0 && count--; )
result = info_search_internal (search_string,
active_window, direction, case_sensitive,
- NULL);
+ bindp);
if (result != 0 && !info_error_was_printed)
info_error ("%s", _("Search failed."));
@@ -4191,9 +4219,20 @@
{
if (!last_search_direction)
info_error ("%s", _("No previous search string"));
+ else if (search_skip_screen_p)
+ {
+ /* Find window bottom */
+ long n = window->height + window->pagetop;
+ if (n < window->line_count)
+ n = window->line_starts[n] - window->node->contents;
+ else
+ n = window->node->nodelen;
+ info_search_1 (window, last_search_direction * count,
+ key, last_search_case_sensitive, 0, n);
+ }
else
info_search_1 (window, last_search_direction * count,
- key, last_search_case_sensitive, 0);
+ key, last_search_case_sensitive, 0, DFL_START);
}
DECLARE_INFO_COMMAND (info_search_previous,
@@ -4201,9 +4240,20 @@
{
if (!last_search_direction)
info_error ("%s", _("No previous search string"));
+ else if (search_skip_screen_p)
+ {
+ /* Find window bottom */
+ long n;
+
+ n = window->line_starts[window->pagetop] - window->node->contents - 1;
+ if (n < 0)
+ n = 0;
+ info_search_1 (window, -last_search_direction * count,
+ key, last_search_case_sensitive, 0, n);
+ }
else
info_search_1 (window, -last_search_direction * count,
- key, last_search_case_sensitive, 0);
+ key, last_search_case_sensitive, 0, DFL_START);
}
/* **************************************************************** */
Modified: trunk/info/variables.c
===================================================================
--- trunk/info/variables.c 2013-06-07 23:47:36 UTC (rev 5261)
+++ trunk/info/variables.c 2013-06-08 19:19:11 UTC (rev 5262)
@@ -86,6 +86,9 @@
N_("Minimal length of a search string"),
&min_search_length, NULL },
+ { "search-skip-screen",
+ N_("Skip current window when searching"),
+ &search_skip_screen_p, (char **)on_off_choices },
{ NULL }
};
Modified: trunk/info/variables.h
===================================================================
--- trunk/info/variables.h 2013-06-07 23:47:36 UTC (rev 5261)
+++ trunk/info/variables.h 2013-06-08 19:19:11 UTC (rev 5262)
@@ -64,5 +64,6 @@
extern int ISO_Latin_p;
extern int scroll_last_node;
extern int min_search_length;
+extern int search_skip_screen_p;
#endif /* not INFO_VARIABLES_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5262] Skip the current screen when repeating searches ("{" and "}").,
Sergey Poznyakoff <=