aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2014-02-20 19:17:54 +0200
committerEli Zaretskii2014-02-20 19:17:54 +0200
commitdba8296c00f035fcf7e200e846a890445606f307 (patch)
treebeca5b86e77ed41f9816927e51c85abbb18d30eb /src
parent44a2be2d6602c4fd4b8bf178eb82baaf4f686208 (diff)
downloademacs-dba8296c00f035fcf7e200e846a890445606f307.tar.gz
emacs-dba8296c00f035fcf7e200e846a890445606f307.zip
Fix assertion violation in redisplay.
src/xdisp.c (try_cursor_movement): Don't use cursor position if set_cursor_from_row failed to compute it. This avoids assertion violations in MATRIX_ROW.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/xdisp.c47
2 files changed, 28 insertions, 22 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b46650a76db..3c063ca3c0b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -2,6 +2,9 @@
2 2
3 * xdisp.c (init_iterator): Don't dereference a bogus face 3 * xdisp.c (init_iterator): Don't dereference a bogus face
4 pointer. (Bug#16819) 4 pointer. (Bug#16819)
5 (try_cursor_movement): Don't use cursor position if
6 set_cursor_from_row failed to compute it. This avoids assertion
7 violations in MATRIX_ROW.
5 8
62014-02-20 Glenn Morris <rgm@gnu.org> 92014-02-20 Glenn Morris <rgm@gnu.org>
7 10
diff --git a/src/xdisp.c b/src/xdisp.c
index 6d5b9d18260..94dd65c5d0b 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -15470,29 +15470,32 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
15470 /* As soon as we've found the exact match for point, 15470 /* As soon as we've found the exact match for point,
15471 or the first suitable row whose ends_at_zv_p flag 15471 or the first suitable row whose ends_at_zv_p flag
15472 is set, we are done. */ 15472 is set, we are done. */
15473 at_zv_p = 15473 if (rv)
15474 MATRIX_ROW (w->current_matrix, w->cursor.vpos)->ends_at_zv_p;
15475 if (rv && !at_zv_p
15476 && w->cursor.hpos >= 0
15477 && w->cursor.hpos < MATRIX_ROW_USED (w->current_matrix,
15478 w->cursor.vpos))
15479 { 15474 {
15480 struct glyph_row *candidate = 15475 at_zv_p = MATRIX_ROW (w->current_matrix,
15481 MATRIX_ROW (w->current_matrix, w->cursor.vpos); 15476 w->cursor.vpos)->ends_at_zv_p;
15482 struct glyph *g = 15477 if (!at_zv_p
15483 candidate->glyphs[TEXT_AREA] + w->cursor.hpos; 15478 && w->cursor.hpos >= 0
15484 ptrdiff_t endpos = MATRIX_ROW_END_CHARPOS (candidate); 15479 && w->cursor.hpos < MATRIX_ROW_USED (w->current_matrix,
15485 15480 w->cursor.vpos))
15486 exact_match_p = 15481 {
15487 (BUFFERP (g->object) && g->charpos == PT) 15482 struct glyph_row *candidate =
15488 || (INTEGERP (g->object) 15483 MATRIX_ROW (w->current_matrix, w->cursor.vpos);
15489 && (g->charpos == PT 15484 struct glyph *g =
15490 || (g->charpos == 0 && endpos - 1 == PT))); 15485 candidate->glyphs[TEXT_AREA] + w->cursor.hpos;
15491 } 15486 ptrdiff_t endpos = MATRIX_ROW_END_CHARPOS (candidate);
15492 if (rv && (at_zv_p || exact_match_p)) 15487
15493 { 15488 exact_match_p =
15494 rc = CURSOR_MOVEMENT_SUCCESS; 15489 (BUFFERP (g->object) && g->charpos == PT)
15495 break; 15490 || (INTEGERP (g->object)
15491 && (g->charpos == PT
15492 || (g->charpos == 0 && endpos - 1 == PT)));
15493 }
15494 if (at_zv_p || exact_match_p)
15495 {
15496 rc = CURSOR_MOVEMENT_SUCCESS;
15497 break;
15498 }
15496 } 15499 }
15497 if (MATRIX_ROW_BOTTOM_Y (row) == last_y) 15500 if (MATRIX_ROW_BOTTOM_Y (row) == last_y)
15498 break; 15501 break;