]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix assertion violation in redisplay.
authorEli Zaretskii <eliz@gnu.org>
Thu, 20 Feb 2014 17:17:54 +0000 (19:17 +0200)
committerEli Zaretskii <eliz@gnu.org>
Thu, 20 Feb 2014 17:17:54 +0000 (19:17 +0200)
 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.

src/ChangeLog
src/xdisp.c

index b46650a76db7ef1655b1e3969927f389bf912b88..3c063ca3c0b1fee26645e1ec5da7a3829ed36afc 100644 (file)
@@ -2,6 +2,9 @@
 
        * xdisp.c (init_iterator): Don't dereference a bogus face
        pointer.  (Bug#16819)
+       (try_cursor_movement): Don't use cursor position if
+       set_cursor_from_row failed to compute it.  This avoids assertion
+       violations in MATRIX_ROW.
 
 2014-02-20  Glenn Morris  <rgm@gnu.org>
 
index 6d5b9d182601c8c68cd69919c3e49971d8dca85f..94dd65c5d0bb2a569b99f6ba5c5954469b7f255d 100644 (file)
@@ -15470,29 +15470,32 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
                  /* As soon as we've found the exact match for point,
                     or the first suitable row whose ends_at_zv_p flag
                     is set, we are done.  */
-                 at_zv_p =
-                   MATRIX_ROW (w->current_matrix, w->cursor.vpos)->ends_at_zv_p;
-                 if (rv && !at_zv_p
-                     && w->cursor.hpos >= 0
-                     && w->cursor.hpos < MATRIX_ROW_USED (w->current_matrix,
-                                                          w->cursor.vpos))
+                 if (rv)
                    {
-                     struct glyph_row *candidate =
-                       MATRIX_ROW (w->current_matrix, w->cursor.vpos);
-                     struct glyph *g =
-                       candidate->glyphs[TEXT_AREA] + w->cursor.hpos;
-                     ptrdiff_t endpos = MATRIX_ROW_END_CHARPOS (candidate);
-
-                     exact_match_p =
-                       (BUFFERP (g->object) && g->charpos == PT)
-                       || (INTEGERP (g->object)
-                           && (g->charpos == PT
-                               || (g->charpos == 0 && endpos - 1 == PT)));
-                   }
-                 if (rv && (at_zv_p || exact_match_p))
-                   {
-                     rc = CURSOR_MOVEMENT_SUCCESS;
-                     break;
+                     at_zv_p = MATRIX_ROW (w->current_matrix,
+                                           w->cursor.vpos)->ends_at_zv_p;
+                     if (!at_zv_p
+                         && w->cursor.hpos >= 0
+                         && w->cursor.hpos < MATRIX_ROW_USED (w->current_matrix,
+                                                              w->cursor.vpos))
+                       {
+                         struct glyph_row *candidate =
+                           MATRIX_ROW (w->current_matrix, w->cursor.vpos);
+                         struct glyph *g =
+                           candidate->glyphs[TEXT_AREA] + w->cursor.hpos;
+                         ptrdiff_t endpos = MATRIX_ROW_END_CHARPOS (candidate);
+
+                         exact_match_p =
+                           (BUFFERP (g->object) && g->charpos == PT)
+                           || (INTEGERP (g->object)
+                               && (g->charpos == PT
+                                   || (g->charpos == 0 && endpos - 1 == PT)));
+                       }
+                     if (at_zv_p || exact_match_p)
+                       {
+                         rc = CURSOR_MOVEMENT_SUCCESS;
+                         break;
+                       }
                    }
                  if (MATRIX_ROW_BOTTOM_Y (row) == last_y)
                    break;