[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5754] incremental search test
From: |
Gavin D. Smith |
Subject: |
[5754] incremental search test |
Date: |
Sun, 17 Aug 2014 16:51:09 +0000 |
Revision: 5754
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5754
Author: gavin
Date: 2014-08-17 16:51:06 +0000 (Sun, 17 Aug 2014)
Log Message:
-----------
incremental search test
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/Makefile.am
trunk/info/session.c
trunk/info/t/infodir/search.info
Added Paths:
-----------
trunk/info/t/inc-sea-forward.sh
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-08-16 14:28:27 UTC (rev 5753)
+++ trunk/ChangeLog 2014-08-17 16:51:06 UTC (rev 5754)
@@ -1,3 +1,15 @@
+2014-08-17 Gavin Smith <address@hidden>
+
+ * info/session.c (incremental_search): Remove unused argument. When
+ searching backward again, position one byte before current match.
+ (info_search_internal, info_search_in_node_internal): Always start
+ search at argument given, not at point. Callers updated.
+
+ * info/t/inc-sea-forward.sh: New test.
+ * info/t/search.info: Remove spaces between two matches and more
+ matches after target to increase chance of ending up in the wrong
+ place.
+
2014-08-16 Gavin Smith <address@hidden>
* info/display.c (display_update_window_1): Check if the next search
Modified: trunk/info/Makefile.am
===================================================================
--- trunk/info/Makefile.am 2014-08-16 14:28:27 UTC (rev 5753)
+++ trunk/info/Makefile.am 2014-08-17 16:51:06 UTC (rev 5754)
@@ -121,6 +121,7 @@
t/relative-reference.sh \
t/resize-in-completions.sh \
t/search-skip-screen.sh \
+ t/inc-sea-forward.sh \
t/anchor-positions.sh \
t/quoted-label-as-target.sh \
t/quoted-target.sh \
Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c 2014-08-16 14:28:27 UTC (rev 5753)
+++ trunk/info/session.c 2014-08-17 16:51:06 UTC (rev 5754)
@@ -3589,17 +3589,14 @@
return result;
}
-/* Search for STRING starting in WINDOW. The starting position is determined
- by the START_OFF argument. If given, *START_OFF is the starting position,
- as long as it is not -1. Otherwise, the search begins at window point +
- DIR.
+/* Search for STRING starting in WINDOW, starting at *START_OFF.
If the string is found in this node, set point to that position.
Otherwise, get the file buffer associated with WINDOW's node, and search
through each node in that file.
If the search succeeds and START_OFF is given, *START_OFF is given the
- start of the found string instance (only for regexp searches).
+ start of the found string instance.
If the search fails, return non-zero, else zero. Side-effect window
leaving the node and point where the string was found current. */
@@ -3646,12 +3643,7 @@
}
/* Set starting position of search. */
- if (start_off && *start_off != -1)
- start = *start_off;
- else
- /* Start just after or before point to avoid ``finding'' a string that
- is already under the cursor. */
- start = window->point + dir;
+ start = *start_off;
/* Search through subsequent nodes, wrapping around to the top
of the Info file until we find the string or return to this
@@ -3956,19 +3948,18 @@
/* */
/* **************************************************************** */
-static void incremental_search (WINDOW *window, int count,
- unsigned char ignore);
+static void incremental_search (WINDOW *window, int count);
DECLARE_INFO_COMMAND (isearch_forward,
_("Search interactively for a string as you type it"))
{
- incremental_search (window, count, key);
+ incremental_search (window, count);
}
DECLARE_INFO_COMMAND (isearch_backward,
_("Search interactively for a string as you type it"))
{
- incremental_search (window, -count, key);
+ incremental_search (window, -count);
}
/* Structure defining the current state of an incremental search. */
@@ -4119,14 +4110,14 @@
/* Read and dispatch loop for incremental search mode. */
static void
-incremental_search (WINDOW *window, int count, unsigned char ignore)
+incremental_search (WINDOW *window, int count)
{
int key;
int last_search_result, search_result, dir;
SEARCH_STATE mystate, orig_state;
char *p;
int case_sensitive = 0;
- long start_off = -1;
+ long start_off = window->point;
long saved_point = window->point;
@@ -4277,8 +4268,11 @@
from a new place if the last search was successful. */
if (search_result == 0)
{
- window->point += dir;
- start_off = -1;
+ start_off = window->point;
+ if (dir < 0)
+ /* Position before match to avoid finding same match
+ agin. */
+ start_off--;
}
}
}
Added: trunk/info/t/inc-sea-forward.sh
===================================================================
--- trunk/info/t/inc-sea-forward.sh (rev 0)
+++ trunk/info/t/inc-sea-forward.sh 2014-08-17 16:51:06 UTC (rev 5754)
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Copyright (C) 2014 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+srcdir=${srcdir:-.}
+. $srcdir/t/Init-test.inc
+. $t/Init-inter.inc
+
+run_ginfo -f search
+
+# Search for "match" with incremental search. Test deleting characters from
+# search string with backspace. Go forward to match in next node. Test
+# we end up at the end of the match string by trying to wrap to the next line
+# with C-f.
+printf '\023matchxy\010\010' >$PTY_TYPE
+printf '\023\023\023\r\006\rDq' >$PTY_TYPE
+
+. $t/Timeout-test.inc
+
+# Return non-zero (test failure) if files differ
+diff $GINFO_OUTPUT $t/node-target
+RETVAL=$?
+
+. $t/Cleanup.inc
+
Property changes on: trunk/info/t/inc-sea-forward.sh
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/info/t/infodir/search.info
===================================================================
(Binary files differ)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5754] incremental search test,
Gavin D. Smith <=