aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2012-04-29 20:19:08 +0300
committerEli Zaretskii2012-04-29 20:19:08 +0300
commit2fa85638a036673b63055a86c6bd5b7b789a9d9d (patch)
tree1558ddc16ae01dfa59773ad699463de173526fe6 /src
parent5a5fd9f33aee06409dfe2feaadaff6bc14f71f58 (diff)
downloademacs-2fa85638a036673b63055a86c6bd5b7b789a9d9d.tar.gz
emacs-2fa85638a036673b63055a86c6bd5b7b789a9d9d.zip
Fix bug #11367 with assertion violation during vertical motion in egg.el.
src/xdisp.c (pos_visible_p): If already at a newline from the display string before the 'while' loop, don't walk back the glyphs from it3.glyph_row. Solves assertion violation when the display string begins with a newline (egg.el).
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/xdisp.c14
2 files changed, 20 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8c80a24b580..e2eb95f60d0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
12012-04-29 Eli Zaretskii <eliz@gnu.org>
2
3 * xdisp.c (pos_visible_p): If already at a newline from the
4 display string before the 'while' loop, don't walk back the glyphs
5 from it3.glyph_row. Solves assertion violation when the display
6 string begins with a newline (egg.el). (Bug#11367)
7
12012-04-24 Chong Yidong <cyd@gnu.org> 82012-04-24 Chong Yidong <cyd@gnu.org>
2 9
3 * xselect.c (x_convert_selection): Initialize a pointer (Bug#11315). 10 * xselect.c (x_convert_selection): Initialize a pointer (Bug#11315).
diff --git a/src/xdisp.c b/src/xdisp.c
index e53d3a57cd6..cc75d386f0d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1375,6 +1375,7 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
1375 Lisp_Object startpos, endpos; 1375 Lisp_Object startpos, endpos;
1376 EMACS_INT start, end; 1376 EMACS_INT start, end;
1377 struct it it3; 1377 struct it it3;
1378 int it3_moved;
1378 1379
1379 /* Find the first and the last buffer positions 1380 /* Find the first and the last buffer positions
1380 covered by the display string. */ 1381 covered by the display string. */
@@ -1431,6 +1432,15 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
1431 begins. */ 1432 begins. */
1432 start_display (&it3, w, top); 1433 start_display (&it3, w, top);
1433 move_it_to (&it3, -1, 0, top_y, -1, MOVE_TO_X | MOVE_TO_Y); 1434 move_it_to (&it3, -1, 0, top_y, -1, MOVE_TO_X | MOVE_TO_Y);
1435 /* If it3_moved stays zero after the 'while' loop
1436 below, that means we already were at a newline
1437 before the loop (e.g., the display string begins
1438 with a newline), so we don't need to (and cannot)
1439 inspect the glyphs of it3.glyph_row, because
1440 PRODUCE_GLYPHS will not produce anything for a
1441 newline, and thus it3.glyph_row stays at its
1442 stale content it got at top of the window. */
1443 it3_moved = 0;
1434 /* Finally, advance the iterator until we hit the 1444 /* Finally, advance the iterator until we hit the
1435 first display element whose character position is 1445 first display element whose character position is
1436 CHARPOS, or until the first newline from the 1446 CHARPOS, or until the first newline from the
@@ -1442,6 +1452,7 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
1442 if (IT_CHARPOS (it3) == charpos 1452 if (IT_CHARPOS (it3) == charpos
1443 || ITERATOR_AT_END_OF_LINE_P (&it3)) 1453 || ITERATOR_AT_END_OF_LINE_P (&it3))
1444 break; 1454 break;
1455 it3_moved = 1;
1445 set_iterator_to_next (&it3, 0); 1456 set_iterator_to_next (&it3, 0);
1446 } 1457 }
1447 top_x = it3.current_x - it3.pixel_width; 1458 top_x = it3.current_x - it3.pixel_width;
@@ -1452,7 +1463,8 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
1452 display string, move back over the glyphs 1463 display string, move back over the glyphs
1453 produced from the string, until we find the 1464 produced from the string, until we find the
1454 rightmost glyph not from the string. */ 1465 rightmost glyph not from the string. */
1455 if (IT_CHARPOS (it3) != charpos && EQ (it3.object, string)) 1466 if (it3_moved
1467 && IT_CHARPOS (it3) != charpos && EQ (it3.object, string))
1456 { 1468 {
1457 struct glyph *g = it3.glyph_row->glyphs[TEXT_AREA] 1469 struct glyph *g = it3.glyph_row->glyphs[TEXT_AREA]
1458 + it3.glyph_row->used[TEXT_AREA]; 1470 + it3.glyph_row->used[TEXT_AREA];