summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2006-05-28 20:19:07 +0000
committerKim F. Storm <storm@cua.dk>2006-05-28 20:19:07 +0000
commita4f3f618ebf3f27c79ddce6e28fca7a04eae1616 (patch)
tree30891fe915a1b8b8fa3b1fd9af75e565722a421a /src
parent794033ae3c7e6a9c3d3e822a22dd5ea62d5c034b (diff)
downloademacs-a4f3f618ebf3f27c79ddce6e28fca7a04eae1616.tar.gz
(set_cursor_from_row): If cursor cannot be set in row,
don't update w->cursor and return 0. Return 1 on success. (try_cursor_movement): Repeat set_cursor_from_row on successive rows until it succeeds.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 6ebc64bf9f5..aa0625532ab 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -11620,9 +11620,11 @@ redisplay_window_1 (window)
/* Set cursor position of W. PT is assumed to be displayed in ROW.
DELTA is the number of bytes by which positions recorded in ROW
- differ from current buffer positions. */
+ differ from current buffer positions.
-void
+ Return 0 if cursor is not on this row. 1 otherwise. */
+
+int
set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
struct window *w;
struct glyph_row *row;
@@ -11772,6 +11774,11 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string));
}
}
+
+ /* If we reached the end of the line, and end was from a string,
+ cursor is not on this line. */
+ if (glyph == end)
+ return 0;
}
w->cursor.hpos = glyph - row->glyphs[TEXT_AREA];
@@ -11805,6 +11812,8 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
else
CHARPOS (this_line_start_pos) = 0;
}
+
+ return 1;
}
@@ -12488,8 +12497,18 @@ try_cursor_movement (window, startp, scroll_step)
rc = CURSOR_MOVEMENT_MUST_SCROLL;
else
{
- set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
- rc = CURSOR_MOVEMENT_SUCCESS;
+ do
+ {
+ if (set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0))
+ {
+ rc = CURSOR_MOVEMENT_SUCCESS;
+ break;
+ }
+ ++row;
+ }
+ while (MATRIX_ROW_BOTTOM_Y (row) < last_y
+ && MATRIX_ROW_START_CHARPOS (row) == PT
+ && cursor_row_p (w, row));
}
}
}