[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6135] info tab fixes
From: |
Gavin D. Smith |
Subject: |
[6135] info tab fixes |
Date: |
Sat, 21 Feb 2015 12:04:08 +0000 |
Revision: 6135
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6135
Author: gavin
Date: 2015-02-21 12:04:07 +0000 (Sat, 21 Feb 2015)
Log Message:
-----------
info tab fixes
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/Makefile.am
trunk/info/session.c
trunk/info/session.h
Added Paths:
-----------
trunk/info/t/infodir/no-xref.info
trunk/info/t/infodir/tab-skip-node.info
trunk/info/t/tab-no-xref.sh
trunk/info/t/tab-skip-node.sh
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-02-20 16:38:40 UTC (rev 6134)
+++ trunk/ChangeLog 2015-02-21 12:04:07 UTC (rev 6135)
@@ -1,3 +1,11 @@
+2015-02-21 Gavin Smith <address@hidden>
+
+ * info/session.c (info_move_to_prev_xref)
+ (info_move_to_next_xref): Don't include skipped-over nodes in
+ window history, and handle case of no xref being found.
+ (cleanup_history): New function.
+ * info/t/tab-no-xref.sh, info/t/tab-skip-node.sh: New tests.
+
2015-02-17 Karl Berry <address@hidden>
* tp/Texinfo/Parser.pm (_parse_texi): do syntactic checks on @U
Modified: trunk/info/Makefile.am
===================================================================
--- trunk/info/Makefile.am 2015-02-20 16:38:40 UTC (rev 6134)
+++ trunk/info/Makefile.am 2015-02-21 12:04:07 UTC (rev 6135)
@@ -114,6 +114,8 @@
t/cr-tag-table.sh \
t/tab.sh \
t/tab-argument.sh \
+ t/tab-no-xref.sh \
+ t/tab-skip-node.sh \
t/body-start.sh \
t/end-of-line.sh \
t/goal-column.sh \
Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c 2015-02-20 16:38:40 UTC (rev 6134)
+++ trunk/info/session.c 2015-02-21 12:04:07 UTC (rev 6135)
@@ -2494,6 +2494,24 @@
void info_move_to_next_xref (WINDOW *, int count);
+/* Remove history entries from START inclusive to END exclusive.
+ Warning: be careful about removing the last history entry, as
+ info_set_node_of_window includes the currently displayed node in
+ the history. */
+static void
+cleanup_history (WINDOW *window, int start, int end)
+{
+ int i;
+ for (i = start; i < end; i++)
+ {
+ free_history_node (window->hist[i]->node);
+ free (window->hist[i]);
+ }
+ memmove (&window->hist[start], &window->hist[end],
+ (window->hist_index - end) * sizeof (WINDOW_STATE *));
+ window->hist_index -= end - start;
+}
+
DECLARE_INFO_COMMAND (info_move_to_prev_xref,
_("Move to the previous cross reference"))
{
@@ -2501,10 +2519,16 @@
info_move_to_next_xref (window, -count);
else
{
+ size_t last_hist_index, starting_hist_index;
+ char *initial_nodename = window->node->nodename;
+
+ last_hist_index = starting_hist_index = window->hist_index - 1;
+
while (count > 0)
{
if (info_move_to_xref (window, -1))
{
+ last_hist_index = window->hist_index - 1;
count--;
continue;
}
@@ -2531,13 +2555,23 @@
return;
}
- if (backward_move_node_structure (window, info_scroll_behaviour)
- != 0)
+ if (backward_move_node_structure (window, info_scroll_behaviour != 0)
+ || !strcmp (window->node->nodename, initial_nodename))
{
- return; /* No earlier nodes in file. */
+ break; /* No earlier nodes in file, or we are back where we
+ started. */
}
window->point = window->node->nodelen - 1;
}
+
+ /* Go back to the last place a reference was found, or
+ the starting place. */
+ while (window->hist_index > last_hist_index + 1)
+ forget_node (window);
+
+ /* Remove any intermediate nodes. */
+ if (last_hist_index != starting_hist_index)
+ cleanup_history (window, starting_hist_index + 1, last_hist_index);
}
}
@@ -2548,10 +2582,16 @@
info_move_to_prev_xref (window, -count);
else
{
+ size_t last_hist_index, starting_hist_index;
+ char *initial_nodename = window->node->nodename;
+
+ last_hist_index = starting_hist_index = window->hist_index - 1;
+
while (count > 0)
{
if (info_move_to_xref (window, 1))
{
+ last_hist_index = window->hist_index - 1;
count--;
continue;
}
@@ -2575,12 +2615,23 @@
return;
}
- if (forward_move_node_structure (window, info_scroll_behaviour)
- != 0)
+ if (forward_move_node_structure (window, info_scroll_behaviour) != 0
+ || !strcmp (window->node->nodename, initial_nodename))
{
- return; /* No later nodes in file. */
+ /*TODO: Print an error. */
+ break; /* No later nodes in file, or we are back where we
+ started. */
}
}
+
+ /* Go back to the last place a reference was found, or
+ the starting place. */
+ while (window->hist_index > last_hist_index + 1)
+ forget_node (window);
+
+ /* Remove any intermediate nodes. */
+ if (last_hist_index != starting_hist_index)
+ cleanup_history (window, starting_hist_index + 1, last_hist_index);
}
}
Modified: trunk/info/session.h
===================================================================
--- trunk/info/session.h 2015-02-20 16:38:40 UTC (rev 6134)
+++ trunk/info/session.h 2015-02-21 12:04:07 UTC (rev 6135)
@@ -49,14 +49,14 @@
extern int cursor_movement_scrolls_p;
+/* Controls what to do when a scrolling command is issued at the end of the
+ last node. */
+extern int scroll_last_node;
+
/* Values for scroll_last_node */
#define SLN_Stop 0 /* Stop at the last node */
#define SLN_Top 1 /* Go to the top node */
-/* Controls what to do when a scrolling command is issued at the end of the
- last node. */
-extern int scroll_last_node;
-
int get_input_key (void);
int get_another_input_key (void);
Added: trunk/info/t/infodir/no-xref.info
===================================================================
(Binary files differ)
Property changes on: trunk/info/t/infodir/no-xref.info
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/info/t/infodir/tab-skip-node.info
===================================================================
(Binary files differ)
Property changes on: trunk/info/t/infodir/tab-skip-node.info
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/info/t/tab-no-xref.sh
===================================================================
--- trunk/info/t/tab-no-xref.sh (rev 0)
+++ trunk/info/t/tab-no-xref.sh 2015-02-21 12:04:07 UTC (rev 6135)
@@ -0,0 +1,27 @@
+#!/bin/sh
+# Copyright (C) 2014, 2015 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 -v scroll-last-node=Top -f no-xref.info
+# Check that pressing tab in a file with no cross-references or menus
+# doesn't cause an infinite loop
+printf '\tq' >$PTY_TYPE
+. $t/Timeout-test.inc
+
+cleanup
Property changes on: trunk/info/t/tab-no-xref.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/info/t/tab-skip-node.sh
===================================================================
--- trunk/info/t/tab-skip-node.sh (rev 0)
+++ trunk/info/t/tab-skip-node.sh 2015-02-21 12:04:07 UTC (rev 6135)
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Copyright (C) 2014, 2015 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 tab-skip-node
+# Check that skipping over a node with no cross-references in it
+# when pressing tab, and then going back in the window history, goes
+# back to the last node that was actually displayed, and not to the
+# skipped node.
+printf '\t\t\tlDq' >$PTY_TYPE
+. $t/Timeout-test.inc
+
+grep 'Node: Top' $GINFO_OUTPUT
+RETVAL=$?
+
+cleanup
Property changes on: trunk/info/t/tab-skip-node.sh
___________________________________________________________________
Added: svn:executable
+ *
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6135] info tab fixes,
Gavin D. Smith <=