texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[5621] WINDOW.current removed


From: Gavin D. Smith
Subject: [5621] WINDOW.current removed
Date: Sat, 31 May 2014 21:02:21 +0000

Revision: 5621
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5621
Author:   gavin
Date:     2014-05-31 21:02:20 +0000 (Sat, 31 May 2014)
Log Message:
-----------
WINDOW.current removed

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/session.c
    trunk/info/window.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-05-31 20:42:57 UTC (rev 5620)
+++ trunk/ChangeLog     2014-05-31 21:02:20 UTC (rev 5621)
@@ -1,5 +1,13 @@
 2014-05-31  Gavin Smith  <address@hidden>
 
+       * info/window.h (WINDOW): 'current' field removed.
+       * info/window.c (set_remembered_pagetop_and_point)
+       (remember_window_and_node, forward_move_node_structure, kill_node):
+       Use nodes_index field instead.  (We cannot go forward in the node
+       history, so the current node is always the last one in the list.)
+
+2014-05-31  Gavin Smith  <address@hidden>
+
        * info/session.c (forget_windows_and_nodes): Don't free node
        structures in a window's history when it is deleted.
 
@@ -9,6 +17,7 @@
        (remember_window_and_node): NODE argument removed.  All callers
        updated.
 
+
 2014-05-31  Gavin Smith  <address@hidden>
 
        * info/window.h (WINDOW): Fields added from INFO_WINDOW:

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2014-05-31 20:42:57 UTC (rev 5620)
+++ trunk/info/session.c        2014-05-31 21:02:20 UTC (rev 5621)
@@ -309,10 +309,10 @@
 void
 set_remembered_pagetop_and_point (WINDOW *win)
 {
-  if (win->nodes_index && win->nodes[win->current] == win->node)
+  if (win->nodes_index && win->nodes[win->nodes_index - 1] == win->node)
     {
-      win->pagetops[win->current] = win->pagetop;
-      win->points[win->current] = win->point;
+      win->pagetops[win->nodes_index - 1] = win->pagetop;
+      win->points[win->nodes_index - 1] = win->point;
     }
 }
 
@@ -324,10 +324,10 @@
      the list of history nodes.  This may happen only at the very
      beginning of the program, I'm not sure.  --karl  */
   if (win->nodes
-      && win->current >= 0
-      && win->nodes[win->current]->contents == win->node->contents
-      && win->pagetops[win->current] == win->pagetop
-      && win->points[win->current] == win->point)
+      && win->nodes_index >= 1
+      && win->nodes[win->nodes_index - 1]->contents == win->node->contents
+      && win->pagetops[win->nodes_index - 1] == win->pagetop
+      && win->points[win->nodes_index - 1] == win->point)
   return;
 
   /* Remember this node, the currently displayed pagetop, and the current
@@ -348,7 +348,7 @@
   win->nodes[win->nodes_index] = win->node;
   win->pagetops[win->nodes_index] = win->pagetop;
   win->points[win->nodes_index] = win->point;
-  win->current = win->nodes_index++;
+  win->nodes_index++;
   win->nodes[win->nodes_index] = NULL;
   win->pagetops[win->nodes_index] = 0;
   win->points[win->nodes_index] = 0;
@@ -1773,11 +1773,8 @@
            can move "Next:".  If that isn't possible, complain that there
            are no more nodes. */
         {
-          int up_counter, old_current;
+          int up_counter;
 
-          /* Remember the current node and location. */
-          old_current = window->current;
-
           /* Back up through the "Up:" pointers until we have found a "Next:"
              that isn't the same as the first menu item found in that node. */
           up_counter = 0;
@@ -1826,10 +1823,9 @@
                       free (window->nodes[window->nodes_index]);
                       window->nodes[window->nodes_index] = NULL;
                     }
-                  window->current = old_current;
-                  window->node = window->nodes[old_current];
-                  window->pagetop = window->pagetops[old_current];
-                  window->point = window->points[old_current];
+                  window->node = window->nodes[window->nodes_index - 1];
+                  window->pagetop = window->pagetops[window->nodes_index - 1];
+                  window->point = window->points[window->nodes_index - 1];
                   recalculate_line_starts (window);
                   window->flags |= W_UpdateWindow;
                   info_error ("%s", _("No more nodes within this document."));
@@ -2918,7 +2914,7 @@
       return;
     }
 
-  if (strcmp (nodename, info_win->nodes[info_win->current]->nodename))
+  if (strcmp (nodename, info_win->nodes[info_win->nodes_index - 1]->nodename))
     return;
 
   if (!info_win)
@@ -2940,17 +2936,16 @@
 
   /* INFO_WIN contains the node that the user wants to stop viewing.  Delete
      this node from the list of nodes previously shown in this window. */
-  for (i = info_win->current; i < info_win->nodes_index; i++)
+  for (i = info_win->nodes_index - 1; i < info_win->nodes_index; i++)
     info_win->nodes[i] = info_win->nodes[i + 1];
 
   /* There is one less node in this window's history list. */
   info_win->nodes_index--;
 
   /* Make this window show the most recent history node. */
-  info_win->current = info_win->nodes_index - 1;
 
-  temp = info_win->nodes[info_win->current];
-  temp->display_pos = info_win->points[info_win->current];
+  temp = info_win->nodes[info_win->nodes_index - 1];
+  temp->display_pos = info_win->points[info_win->nodes_index - 1];
   window_set_node_of_window (info_win, temp);
 
   if (!info_error_was_printed)

Modified: trunk/info/window.h
===================================================================
--- trunk/info/window.h 2014-05-31 20:42:57 UTC (rev 5620)
+++ trunk/info/window.h 2014-05-31 21:02:20 UTC (rev 5621)
@@ -88,7 +88,6 @@
   NODE **nodes;                 /* Array of nodes visited in this window. */
   int *pagetops;                /* For each node in NODES, the pagetop. */
   long *points;                 /* For each node in NODES, the point. */
-  int current;                  /* Index in NODES of the current node. */
   int nodes_index;              /* Index where to add the next node. */
   int nodes_slots;              /* Number of slots allocated to NODES. */
 } WINDOW;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]