texinfo-commits
[Top][All Lists]
Advanced

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

[5727] goal column test


From: Gavin D. Smith
Subject: [5727] goal column test
Date: Mon, 28 Jul 2014 19:39:39 +0000

Revision: 5727
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5727
Author:   gavin
Date:     2014-07-28 19:39:37 +0000 (Mon, 28 Jul 2014)
Log Message:
-----------
goal column test

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/Makefile.am
    trunk/info/nodes.c
    trunk/info/session.c
    trunk/info/t/infodir/intera.info
    trunk/info/window.c
    trunk/info/window.h

Added Paths:
-----------
    trunk/info/t/goal-column.sh

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-07-27 18:55:01 UTC (rev 5726)
+++ trunk/ChangeLog     2014-07-28 19:39:37 UTC (rev 5727)
@@ -1,3 +1,13 @@
+2014-07-28  Gavin Smith  <address@hidden>
+
+       * info/nodes.c (info_get_node_of_file_buffer): Set body_start to 0
+       for "*" node.
+       * info/session.c (info_next_line, info_prev_line): Don't change goal
+       column.
+       * info/window.c (window_chars_to_goal): Merged into caller.
+       * info/t/goal-column.sh: New test.
+       * info/t/infodir/intera.info: Node "Goal column" added.
+
 2014-07-27  Gavin Smith  <address@hidden>
 
        * info/session.c (info_search_in_node): Merged into callers in

Modified: trunk/info/Makefile.am
===================================================================
--- trunk/info/Makefile.am      2014-07-27 18:55:01 UTC (rev 5726)
+++ trunk/info/Makefile.am      2014-07-28 19:39:37 UTC (rev 5727)
@@ -107,6 +107,7 @@
        t/tab.sh \
        t/body-start.sh \
        t/end-of-line.sh \
+       t/goal-column.sh \
        t/last-no-history.sh \
        t/adjust-anchors.sh \
        t/search-after-tag.sh \

Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c  2014-07-27 18:55:01 UTC (rev 5726)
+++ trunk/info/nodes.c  2014-07-28 19:39:37 UTC (rev 5727)
@@ -1072,7 +1072,7 @@
       node->nodename = xstrdup ("*");
       node->contents = file_buffer->contents;
       node->nodelen = file_buffer->filesize;
-      node_set_body_start (node);
+      node->body_start = 0;
     }
   /* If this is the "main" info file, it might contain a tags table.  Search
      the tags table for an entry which matches the node that we want.  If

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2014-07-27 18:55:01 UTC (rev 5726)
+++ trunk/info/session.c        2014-07-28 19:39:37 UTC (rev 5727)
@@ -839,7 +839,8 @@
 int window_scroll_step = 1;
 
 /* Used after cursor movement commands.  Scroll window so that point is
-   visible, and move the terminal cursor there. */
+   visible, and move the terminal cursor there.  Record current column in
+   WINDOW->goal_column. */
 static void
 info_show_point (WINDOW *window)
 {
@@ -925,12 +926,21 @@
 static void
 move_to_goal_column (WINDOW *window)
 {
-  int line;
+  int line, goal, chars_to_goal;
 
   line = window_line_of_point (window);
 
   window->point = window->line_starts[line];
-  window->point += window_chars_to_goal (window, window->goal_column);
+
+  /* Count the number of characters in LINE that precede the printed column
+     offset of GOAL. */
+  goal = window->goal_column;
+  window_compute_line_map (window);
+  if (goal >= window->line_map.used)
+    goal = window->line_map.used - 1;
+  chars_to_goal = window->line_map.map[goal] - window->line_map.map[0];
+
+  window->point += chars_to_goal;
 }
 
 /* Return true if POINT sits on a newline character. */
@@ -1083,9 +1093,12 @@
       long saved_goal = window->goal_column;
       while (count--)
         point_next_line (window);
-      window->goal_column = saved_goal;
       move_to_goal_column (window);
       info_show_point (window);
+      /* Don't change the goal column when going up and down.  This means we
+         can go from a long line to a short line and back to a long line and
+         end back in the same column. */
+      window->goal_column = saved_goal;
     }
 }
 
@@ -1099,9 +1112,9 @@
       long saved_goal = window->goal_column;
       while (count--)
         point_prev_line (window);
-      window->goal_column = saved_goal;
       move_to_goal_column (window);
       info_show_point (window);
+      window->goal_column = saved_goal;
     }
 }
 

Added: trunk/info/t/goal-column.sh
===================================================================
--- trunk/info/t/goal-column.sh                         (rev 0)
+++ trunk/info/t/goal-column.sh 2014-07-28 19:39:37 UTC (rev 5727)
@@ -0,0 +1,32 @@
+#!/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 intera -n 'Goal column'
+
+printf '/^Goal column test\r\016' >$PTY_TYPE
+printf '\005\016\016\006\006' >$PTY_TYPE
+printf '\rDq' >$PTY_TYPE
+. $t/Timeout-test.inc
+
+diff $GINFO_OUTPUT $t/node-target
+RETVAL=$?
+
+. $t/Cleanup.inc
+


Property changes on: trunk/info/t/goal-column.sh
___________________________________________________________________
Added: svn:executable
   + *

Modified: trunk/info/t/infodir/intera.info
===================================================================
(Binary files differ)

Modified: trunk/info/window.c
===================================================================
--- trunk/info/window.c 2014-07-27 18:55:01 UTC (rev 5726)
+++ trunk/info/window.c 2014-07-28 19:39:37 UTC (rev 5727)
@@ -856,17 +856,6 @@
   return window_point_to_column (window, window->point, &window->point);
 }
 
-/* Count the number of characters in LINE that precede the printed column
-   offset of GOAL. */
-int
-window_chars_to_goal (WINDOW *win, int goal)
-{
-  window_compute_line_map (win);
-  if (goal >= win->line_map.used)
-    goal = win->line_map.used - 1;
-  return win->line_map.map[goal] - win->line_map.map[0];
-}
-
 /* Create a modeline for WINDOW, and store it in window->modeline. */
 void
 window_make_modeline (WINDOW *window)

Modified: trunk/info/window.h
===================================================================
--- trunk/info/window.h 2014-07-27 18:55:01 UTC (rev 5726)
+++ trunk/info/window.h 2014-07-28 19:39:37 UTC (rev 5727)
@@ -225,10 +225,6 @@
 extern void window_get_state (WINDOW *window, SEARCH_STATE *state);
 extern void window_set_state (WINDOW *window, SEARCH_STATE *state);
 
-/* Count the number of characters in current line of WIN that precede
-   the printed column offset of GOAL. */
-extern int window_chars_to_goal (WINDOW *win, int goal);
-
 extern size_t process_node_text
         (WINDOW *win, char *start,
          int (*fun) (WINDOW *, size_t, size_t, size_t, char *,




reply via email to

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