[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5837] goal column is current column except after next-line or prev-line
From: |
Gavin D. Smith |
Subject: |
[5837] goal column is current column except after next-line or prev-line |
Date: |
Wed, 24 Sep 2014 13:07:19 +0000 |
Revision: 5837
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5837
Author: gavin
Date: 2014-09-24 13:07:18 +0000 (Wed, 24 Sep 2014)
Log Message:
-----------
goal column is current column except after next-line or prev-line
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/session.c
trunk/info/window.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-09-24 12:15:55 UTC (rev 5836)
+++ trunk/ChangeLog 2014-09-24 13:07:18 UTC (rev 5837)
@@ -6,6 +6,13 @@
* doc/info-stnd.texi (Miscellaneous Commands, Cursor Commands): Fix
minor typos.
+ * info/session.c (move_to_goal_column): New function, split from
+ info_next_line and info_prev_line. Interpret -1 as goal column to
+ mean the current column.
+ (info_show_point): Don't set goal_column.
+ (info_read_and_dispatch): Set goal_column to -1 unless previous
+ commmand was next-line or prev-line.
+
2014-09-22 Gavin Smith <address@hidden>
* info/session.c (info_dispatch_on_key): Don't set
Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c 2014-09-24 12:15:55 UTC (rev 5836)
+++ trunk/info/session.c 2014-09-24 13:07:18 UTC (rev 5837)
@@ -249,7 +249,16 @@
VFunction *cmd = info_dispatch_on_key (key, info_keymap);
if (cmd)
{
+ void info_next_line (WINDOW *, int count, int key);
+ void info_prev_line (WINDOW *, int count, int key);
+
(*cmd) (active_window, 1, key);
+
+ /* 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. */
+ if (!(cmd == &info_next_line || cmd == &info_prev_line))
+ active_window->goal_column = -1; /* Goal is current column. */
}
}
}
@@ -997,8 +1006,6 @@
static void
info_show_point (WINDOW *window)
{
- window->goal_column = window_get_cursor_column (window);
-
if (window_scroll_step == 0)
window_adjust_pagetop (window);
else
@@ -1219,6 +1226,19 @@
void info_prev_line (WINDOW *, int count, int key);
+/* Move to goal column, or end of line. */
+static long
+move_to_goal_column (WINDOW *window)
+{
+ long goal;
+
+ goal = window->goal_column;
+ if (goal >= window->line_map.used)
+ goal = window->line_map.used - 1;
+ window->point = window->line_map.map[goal];
+ info_show_point (window);
+}
+
/* Move WINDOW's point down to the next line if possible. */
DECLARE_INFO_COMMAND (info_next_line, _("Move down to the next line"))
{
@@ -1226,22 +1246,11 @@
info_prev_line (window, -count, key);
else
{
- long saved_goal = window->goal_column;
- long goal;
+ if (window->goal_column == -1)
+ window->goal_column = window_get_cursor_column (window);
while (count--)
point_next_line (window);
-
- /* Move to goal column, or end of line. */
- goal = saved_goal;
- if (goal >= window->line_map.used)
- goal = window->line_map.used - 1;
- window->point = window->line_map.map[goal];
-
- 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;
+ move_to_goal_column (window);
}
}
@@ -1252,19 +1261,11 @@
info_next_line (window, -count, key);
else
{
- long saved_goal = window->goal_column;
- long goal;
+ if (window->goal_column == -1)
+ window->goal_column = window_get_cursor_column (window);
while (count--)
point_prev_line (window);
-
- /* Move to goal column, or end of line. */
- goal = saved_goal;
- if (goal >= window->line_map.used)
- goal = window->line_map.used - 1;
- window->point = window->line_map.map[goal];
-
- info_show_point (window);
- window->goal_column = saved_goal;
+ move_to_goal_column (window);
}
}
Modified: trunk/info/window.h
===================================================================
--- trunk/info/window.h 2014-09-24 12:15:55 UTC (rev 5836)
+++ trunk/info/window.h 2014-09-24 13:07:18 UTC (rev 5837)
@@ -76,7 +76,8 @@
long width; /* Width of this window. */
long height; /* Height of this window. */
long first_row; /* Offset of the first line in the_screen. */
- long goal_column; /* The column we would like the cursor to appear in. */
+ long goal_column; /* Column to place the cursor in when moving it up and
+ down. -1 means the column it is currently in. */
WINDOW_STATE_DECL; /* Node, pagetop and point. */
LINE_MAP line_map; /* Current line map */
char *modeline; /* Calculated text of the modeline for this window. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5837] goal column is current column except after next-line or prev-line,
Gavin D. Smith <=