[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5813] scroll-last-node when last node doesn't have Top as Up
From: |
Gavin D. Smith |
Subject: |
[5813] scroll-last-node when last node doesn't have Top as Up |
Date: |
Tue, 09 Sep 2014 14:51:51 +0000 |
Revision: 5813
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5813
Author: gavin
Date: 2014-09-09 14:51:49 +0000 (Tue, 09 Sep 2014)
Log Message:
-----------
scroll-last-node when last node doesn't have Top as Up
Modified Paths:
--------------
trunk/ChangeLog
trunk/doc/info-stnd.texi
trunk/info/Makefile.am
trunk/info/session.c
trunk/info/session.h
Added Paths:
-----------
trunk/info/t/infodir/last-node-not-top-level.info
trunk/info/t/last-node-not-top-level.sh
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-09-08 16:08:25 UTC (rev 5812)
+++ trunk/ChangeLog 2014-09-09 14:51:49 UTC (rev 5813)
@@ -1,3 +1,21 @@
+2014-09-09 Gavin Smith <address@hidden>
+
+ * info/session.c (forward_move_node_structure)
+ (backward_move_node_structure): Disable for internal nodes.
+ (forward_move_node_structure) <scroll-behaviour=Continous>: Detect if
+ we are at the last node even if it does not have its Up pointer going
+ to "Top".
+ * info/session.h (SLN_Scroll, SLN_Top),:
+ * doc/info-stnd.texi (Variables) <scroll-last-node>,
+ * info/session.c (scroll_last_node_choices): 'Scroll' option removed,
+ as a non-index node with a menu will never be the last node.
+ * info/t/last-node-not-top-level.sh: New test.
+ * info/t/infodir/last-node-not-top-level.info: New file.
+
+ * info/session.c (select_menu_digit): Don't print any error messages.
+ (info_menu_digit): Display error message if there is no menu in
+ the node.
+
2014-09-08 Gavin Smith <address@hidden>
* info/session.c (info_set_node_of_window): Don't get or remove
Modified: trunk/doc/info-stnd.texi
===================================================================
--- trunk/doc/info-stnd.texi 2014-09-08 16:08:25 UTC (rev 5812)
+++ trunk/doc/info-stnd.texi 2014-09-09 14:51:49 UTC (rev 5813)
@@ -2256,22 +2256,13 @@
Do not scroll. Display the @samp{No more nodes within this document.}
message. This is the default.
address@hidden Scroll
-Scroll as usual. Since the last node is usually an index, this means
-that the very first node from the menu will be selected.
-
@item Top
-Go to the top node of this document.
+Go to the top node of the document.
@end table
This variable is in effect only if @code{scroll-behaviour} is set to
@code{Continuous}.
-Notice that the default behavior has changed in version 4.12. Previous
-versions behaved as if @code{scroll-last-node=Scroll} was set. This
-behavior was counter-intuitive, therefore since version 4.12 the
-default is to stop at the last node.
-
@item scroll-step
@vindex scroll-step
The number of lines to scroll to bring the cursor back into the window.
Modified: trunk/info/Makefile.am
===================================================================
--- trunk/info/Makefile.am 2014-09-08 16:08:25 UTC (rev 5812)
+++ trunk/info/Makefile.am 2014-09-09 14:51:49 UTC (rev 5813)
@@ -111,6 +111,7 @@
t/goal-column.sh \
t/last-no-history.sh \
t/split-footnotes.sh \
+ t/last-node-not-top-level.sh \
t/adjust-anchors.sh \
t/search-after-tag.sh \
t/split-file-menu.sh \
Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c 2014-09-08 16:08:25 UTC (rev 5812)
+++ trunk/info/session.c 2014-09-09 14:51:49 UTC (rev 5813)
@@ -1925,7 +1925,7 @@
/* Choices for the scroll-last-node variable */
char *scroll_last_node_choices[] = {
- "Stop", "Scroll", "Top", NULL
+ "Stop", "Top", NULL
};
/* Controls what to do when a scrolling command is issued at the end of the
@@ -1938,6 +1938,9 @@
static int
forward_move_node_structure (WINDOW *window, int behaviour)
{
+ if (window->node->flags & N_IsInternal)
+ return 1;
+
switch (behaviour)
{
case IS_PageOnly:
@@ -1950,28 +1953,6 @@
case IS_Continuous:
{
- /* If last node in file */
- if (!window->node->next &&
- !(window->node->up && strcmp ("Top", window->node->up)))
- {
- switch (scroll_last_node)
- {
- case SLN_Stop:
- info_error ("%s", _("No more nodes within this document."));
- return 1;
-
- case SLN_Scroll:
- break;
-
- case SLN_Top:
- info_top_node (window, 1, 0);
- return 0;
-
- default:
- abort ();
- }
- }
-
/* If this node contains a menu, select its first entry. Indices
are an exception, as their menus lead nowhere meaningful. */
if (!(window->node->flags & N_IsIndex))
@@ -2030,15 +2011,27 @@
}
else
{
- /* No more "Up" pointers. Print an error, and call it
- quits. */
+ /* No more "Up" pointers. We are at the last node in the
+ file. */
register int i;
for (i = 0; i < up_counter; i++)
forget_node (window);
- info_error ("%s", _("No more nodes within this document."));
- return 1;
+ switch (scroll_last_node)
+ {
+ case SLN_Stop:
+ info_error ("%s",
+ _("No more nodes within this document."));
+ return 1;
+
+ case SLN_Top:
+ info_top_node (window, 1, 0);
+ return 0;
+
+ default:
+ abort ();
+ }
}
}
}
@@ -2053,6 +2046,9 @@
static int
backward_move_node_structure (WINDOW *window, int behaviour)
{
+ if (window->node->flags & N_IsInternal)
+ return 1;
+
switch (behaviour)
{
case IS_PageOnly:
@@ -2253,14 +2249,9 @@
register REFERENCE **menu;
menu = window->node->references;
-
if (!menu)
- {
- info_error ("%s", msg_no_menu_node);
- return 0;
- }
+ return 0;
- /* We have the menu. See if there are this many items in it. */
item = key - '0';
/* Special case. Item "0" is the last item in this menu. */
@@ -2271,7 +2262,6 @@
for (j = 0; menu[j]; j++)
if (menu[j]->type == REFERENCE_MENU_ITEM)
i = j;
- if (i == -1) return 0;
}
else
{
@@ -2285,6 +2275,9 @@
}
}
+ if (i == -1)
+ return 0;
+
return menu[i];
}
@@ -2293,13 +2286,21 @@
{
int item = key - '0';
REFERENCE *entry;
+ REFERENCE **references = window->node->references;
- if (!window->node->references)
+ /* Check if there is a menu in this node. */
+ if (references)
{
- info_error ("%s", msg_no_menu_node);
- return;
+ int i;
+ for (i = 0; references[i]; i++)
+ if (references[i]->type == REFERENCE_MENU_ITEM)
+ goto has_menu;
}
+ info_error ("%s", msg_no_menu_node);
+ return;
+has_menu:
+
if (entry = select_menu_digit (window, key))
info_select_reference (window, entry);
else if (key == '0')
Modified: trunk/info/session.h
===================================================================
--- trunk/info/session.h 2014-09-08 16:08:25 UTC (rev 5812)
+++ trunk/info/session.h 2014-09-09 14:51:49 UTC (rev 5813)
@@ -65,8 +65,7 @@
/* Values for scroll_last_node */
#define SLN_Stop 0 /* Stop at the last node */
-#define SLN_Scroll 1 /* Do usual scrolling */
-#define SLN_Top 2 /* Go to the top node */
+#define SLN_Top 1 /* Go to the top node */
int get_input_key (void);
int get_another_input_key (void);
Added: trunk/info/t/infodir/last-node-not-top-level.info
===================================================================
(Binary files differ)
Property changes on: trunk/info/t/infodir/last-node-not-top-level.info
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/info/t/last-node-not-top-level.sh
===================================================================
--- trunk/info/t/last-node-not-top-level.sh (rev 0)
+++ trunk/info/t/last-node-not-top-level.sh 2014-09-09 14:51:49 UTC (rev
5813)
@@ -0,0 +1,31 @@
+#!/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 last-node-not-top-level -v scroll-last-node=Top
+
+# Wrap round to top node when last node does not have Top as Up
+printf ']]]Dq' >$PTY_TYPE
+. $t/Timeout-test.inc
+
+grep 'Node: Top' $GINFO_OUTPUT
+RETVAL=$?
+
+. $t/Cleanup.inc
+
Property changes on: trunk/info/t/last-node-not-top-level.sh
___________________________________________________________________
Added: svn:executable
+ *
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5813] scroll-last-node when last node doesn't have Top as Up,
Gavin D. Smith <=