[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * info/session.c (info_read_and_dispatch, info_ne
From: |
Patrice Dumas |
Subject: |
branch master updated: * info/session.c (info_read_and_dispatch, info_next_line) (info_prev_line), info/window.c (window_make_window) (set_window_pagetop), info/window.h (WINDOW): instead of using -1 value of WINDOW goal_column to signal that the cursor should be placed in the column it is currently in, add and use the W_CurrentColGoal flag. Set WINDOW goal_column to size_t as it is compared to unsigned fields of LINE_MAP. |
Date: |
Thu, 10 Oct 2024 16:23:22 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 9beac1c669 * info/session.c (info_read_and_dispatch, info_next_line)
(info_prev_line), info/window.c (window_make_window) (set_window_pagetop),
info/window.h (WINDOW): instead of using -1 value of WINDOW goal_column to
signal that the cursor should be placed in the column it is currently in, add
and use the W_CurrentColGoal flag. Set WINDOW goal_column to size_t as it is
compared to unsigned fields of LINE_MAP.
9beac1c669 is described below
commit 9beac1c669902f9dd653e8ba67eb0a059464e362
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Oct 10 22:23:13 2024 +0200
* info/session.c (info_read_and_dispatch, info_next_line)
(info_prev_line), info/window.c (window_make_window)
(set_window_pagetop), info/window.h (WINDOW): instead of using -1
value of WINDOW goal_column to signal that the cursor should be
placed in the column it is currently in, add and use the
W_CurrentColGoal flag. Set WINDOW goal_column to size_t as it is
compared to unsigned fields of LINE_MAP.
---
ChangeLog | 10 ++++++++++
info/session.c | 16 +++++++++++-----
info/window.c | 8 ++++----
info/window.h | 6 ++++--
4 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 53fd44a234..70a812e35e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-10-10 Patrice Dumas <pertusus@free.fr>
+
+ * info/session.c (info_read_and_dispatch, info_next_line)
+ (info_prev_line), info/window.c (window_make_window)
+ (set_window_pagetop), info/window.h (WINDOW): instead of using -1
+ value of WINDOW goal_column to signal that the cursor should be
+ placed in the column it is currently in, add and use the
+ W_CurrentColGoal flag. Set WINDOW goal_column to size_t as it is
+ compared to unsigned fields of LINE_MAP.
+
2024-10-10 Patrice Dumas <pertusus@free.fr>
* info/window.c (collect_line_starts): add a comment to explain that
diff --git a/info/session.c b/info/session.c
index fee7d83c86..7bd5eeaa7e 100644
--- a/info/session.c
+++ b/info/session.c
@@ -256,7 +256,7 @@ info_read_and_dispatch (void)
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. */
+ active_window->flags |= W_CurrentColGoal; /* Goal is current
column. */
}
}
}
@@ -1261,8 +1261,11 @@ DECLARE_INFO_COMMAND (info_next_line, _("Move down to
the next line"))
info_prev_line (window, -count);
else
{
- if (window->goal_column == -1)
- window->goal_column = window_get_cursor_column (window);
+ if (window->flags & W_CurrentColGoal)
+ {
+ window->goal_column = window_get_cursor_column (window);
+ window->flags &= ~W_CurrentColGoal;
+ }
while (count--)
point_next_line (window);
move_to_goal_column (window);
@@ -1276,8 +1279,11 @@ DECLARE_INFO_COMMAND (info_prev_line, _("Move up to the
previous line"))
info_next_line (window, -count);
else
{
- if (window->goal_column == -1)
- window->goal_column = window_get_cursor_column (window);
+ if (window->flags & W_CurrentColGoal)
+ {
+ window->goal_column = window_get_cursor_column (window);
+ window->flags &= ~W_CurrentColGoal;
+ }
while (count--)
point_prev_line (window);
move_to_goal_column (window);
diff --git a/info/window.c b/info/window.c
index 407494c175..cddfc678b5 100644
--- a/info/window.c
+++ b/info/window.c
@@ -289,11 +289,11 @@ window_make_window (void)
window->height = (active_window->height / 2) - 1;
window->first_row = active_window->first_row +
(active_window->height - window->height);
- window->goal_column = -1;
+ window->goal_column = 0;
memset (&window->line_map, 0, sizeof (window->line_map));
window->modeline = xmalloc (1 + window->width);
window->line_starts = NULL;
- window->flags = W_UpdateWindow | W_WindowVisible;
+ window->flags = W_UpdateWindow | W_WindowVisible | W_CurrentColGoal;
/* Adjust the height of the old active window. */
active_window->height -= (window->height + 1);
@@ -735,17 +735,17 @@ set_window_pagetop (WINDOW *window, int desired_top)
window->pagetop = desired_top;
/* Make sure that point appears in this window. */
+ window->goal_column = 0;
+ window->flags &= ~W_CurrentColGoal;
point_line = window_line_of_point (window);
if (point_line < window->pagetop)
{
window->point = window->line_starts[window->pagetop];
- window->goal_column = 0;
}
else if (point_line >= window->pagetop + window->height)
{
long bottom = window->pagetop + window->height - 1;
window->point = window->line_starts[bottom];
- window->goal_column = 0;
}
window->flags |= W_UpdateWindow;
diff --git a/info/window.h b/info/window.h
index ea3afa1fe6..157068f117 100644
--- a/info/window.h
+++ b/info/window.h
@@ -77,8 +77,8 @@ typedef struct window_struct
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; /* Column to place the cursor in when moving it up and
- down. -1 means the column it is currently in. */
+ size_t goal_column; /* Column to place the cursor in when moving it up and
+ down (if W_CurrentColGoal flag is not set). */
NODE *node; /* The node displayed in this window. */
long pagetop; /* LINE_STARTS[PAGETOP] is first line in WINDOW. */
long point; /* Offset within NODE of the cursor position. */
@@ -110,6 +110,8 @@ typedef struct window_struct
#define W_NoWrap 0x10 /* Lines do not wrap in this window. */
#define W_InputWindow 0x20 /* Window accepts input. */
#define W_TempWindow 0x40 /* Window is less important. */
+#define W_CurrentColGoal 0x80 /* Use the current column to place the
+ cursor in when moving it up and down. */
extern WINDOW *windows; /* List of visible Info windows. */
extern WINDOW *active_window; /* The currently active window. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * info/session.c (info_read_and_dispatch, info_next_line) (info_prev_line), info/window.c (window_make_window) (set_window_pagetop), info/window.h (WINDOW): instead of using -1 value of WINDOW goal_column to signal that the cursor should be placed in the column it is currently in, add and use the W_CurrentColGoal flag. Set WINDOW goal_column to size_t as it is compared to unsigned fields of LINE_MAP.,
Patrice Dumas <=