[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7777] info fix moving point across start of a node
From: |
gavinsmith0123 |
Subject: |
[7777] info fix moving point across start of a node |
Date: |
Sat, 13 May 2017 17:14:05 -0400 (EDT) |
Revision: 7777
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7777
Author: gavin
Date: 2017-05-13 17:14:05 -0400 (Sat, 13 May 2017)
Log Message:
-----------
info fix moving point across start of a node
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/session.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2017-05-13 19:00:40 UTC (rev 7776)
+++ trunk/ChangeLog 2017-05-13 21:14:05 UTC (rev 7777)
@@ -1,5 +1,14 @@
2017-05-13 Gavin Smith <address@hidden>
+ * info/sesson.c (point_backward_char): Change return type to int
+ and return 0 on failure. Make sure we always go backwards.
+ (point_backward_word): Use point_backward_char to simplify code.
+
+ This continues the fix of the bug of the point getting stuck
+ at the start of a node (partially fixed on 2017-05-11).
+
+2017-05-13 Gavin Smith <address@hidden>
+
* doc/info-stnd.texi (Xref Commands, Parts of an Xref)
(Selecting Xrefs): Change 'cross reference' to 'cross-reference'.
Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c 2017-05-13 19:00:40 UTC (rev 7776)
+++ trunk/info/session.c 2017-05-13 21:14:05 UTC (rev 7777)
@@ -1154,21 +1154,27 @@
point_next_line (win);
}
-/* Set point to the previous multibyte character. */
-static void
+/* Set point to the previous multibyte character. Return 0 if we can't
+ go any further. */
+static int
point_backward_char (WINDOW *win)
{
long point = win->point;
int col;
- col = window_point_to_column (win, point, 0);
+ /* Find column in the line map before the current one that moves the
+ point backward. */
+ col = window_point_to_column (win, point, 0) - 1;
for (; col >= 0 && win->line_map.map[col] == point; col--)
;
if (col >= 0)
- win->point = win->line_map.map[col];
+ {
+ win->point = win->line_map.map[col];
+ return 1;
+ }
else
- point_prev_line (win);
+ return point_prev_line (win);
}
/* Advance window point to the beginning of the next word. */
@@ -1214,42 +1220,17 @@
{
int col;
- point_backward_char (win);
- col = window_point_to_column (win, win->point, &win->point);
-
- /* Skip white space backwards. */
- while (1)
+ /* Skip any white space before current cursor position. */
+ while (point_backward_char (win))
{
- for (; col >= 0; col--)
- {
- win->point = win->line_map.map[col];
- if (looking_at_alnum (win))
- goto skipped_whitespace;
- }
- if (!point_prev_line (win))
- return;
- col = win->line_map.used - 1;
+ if (looking_at_alnum (win))
+ goto back_to_word_start;
}
- skipped_whitespace:
- while (1)
+back_to_word_start:
+ while (point_backward_char (win))
{
- for (; col >= 0; col--)
- {
- win->point = win->line_map.map[col];
- if (win->point == 0)
- return;
- if (!looking_at_alnum (win))
- {
- point_forward_char (win);
- return;
- }
- }
- if (!point_prev_line (win))
- return;
- col = win->line_map.used - 1;
-
- if (looking_at_newline (win, win->point))
+ if (!looking_at_alnum (win))
{
point_forward_char (win);
return;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7777] info fix moving point across start of a node,
gavinsmith0123 <=