[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [help-texinfo] info remembering cursor position
From: |
Sergey Poznyakoff |
Subject: |
Re: [help-texinfo] info remembering cursor position |
Date: |
Sat, 13 Apr 2013 11:25:36 +0300 |
Hi,
Karl Berry <address@hidden> ha escrit:
> Nevertheless, I can see how it would be nicer if it remembered the line
> if you ended up back at the "l" node regardless of what command was used
> to get there. I've wished for that myself sometimes.
Of course it is possible. Attached is the patch that implements it.
Please give it a try. Perhaps we should better make this feature
dependent on some setting in ~/.infokey?
Regards,
Sergey
Index: info/session.c
===================================================================
--- info/session.c (revision 5245)
+++ info/session.c (working copy)
@@ -2113,6 +2113,22 @@ info_parse_and_select (char *line, WINDO
info_select_reference (window, &entry);
}
+static int
+info_win_find_node (INFO_WINDOW *win, NODE *node)
+{
+ int i;
+
+ for (i = win->nodes_index - 1; i >= 0; i--)
+ {
+ NODE *p = win->nodes[i];
+
+ if (strcmp (p->filename, node->filename) == 0 &&
+ strcmp (p->nodename, node->nodename) == 0)
+ break;
+ }
+ return i;
+}
+
/* Given that the values of INFO_PARSED_FILENAME and INFO_PARSED_NODENAME
are previously filled, try to get the node represented by them into
WINDOW. The node should have been pointed to by the LABEL pointer of
@@ -2151,7 +2167,13 @@ info_handle_pointer (char *label, WINDOW
info_win = get_info_window_of_window (window);
if (info_win)
{
- info_win->pagetops[info_win->current] = window->pagetop;
+ if (strcmp (label, "Up") == 0)
+ {
+ int i = info_win_find_node (info_win, node);
+ if (i >= 0)
+ node->display_pos = info_win->points[i];
+ }
+ info_win->pagetops[info_win->current] = window->pagetop;
info_win->points[info_win->current] = window->point;
}
info_set_node_of_window (1, window, node);