summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2012-05-02 00:20:29 -0700
committerGlenn Morris <rgm@gnu.org>2012-05-02 00:20:29 -0700
commit90207a152538c00b6c75b9774b528470dfb42717 (patch)
tree6ee42e42631521d624a85d69dc914161309726b2 /src
parent6116bd7e7a88d47eb8bf0b830249461f47f8b943 (diff)
parentcd3771a08b8a1fed5aa91eb2ac559d41801668ea (diff)
downloademacs-90207a152538c00b6c75b9774b528470dfb42717.tar.gz
Merge from emacs-24; up to 2012-04-16T19:06:02Z!rgm@gnu.org
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 f624517efb2..fb5cab2ac3c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2012-05-02 Eli Zaretskii <eliz@gnu.org>
+
+ * 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). (Bug#11367)
+
2012-05-01 Stefan Monnier <monnier@iro.umontreal.ca>
* keyboard.c (Fexecute_extended_command, Vsuggest_key_bindings):
diff --git a/src/xdisp.c b/src/xdisp.c
index 307331627f5..da44281a55e 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1385,6 +1385,7 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
Lisp_Object startpos, endpos;
EMACS_INT start, end;
struct it it3;
+ int it3_moved;
/* Find the first and the last buffer positions
covered by the display string. */
@@ -1441,6 +1442,15 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
begins. */
start_display (&it3, w, top);
move_it_to (&it3, -1, 0, top_y, -1, MOVE_TO_X | MOVE_TO_Y);
+ /* If it3_moved stays zero after the 'while' loop
+ below, that means we already were at a newline
+ before the loop (e.g., the display string begins
+ with a newline), so we don't need to (and cannot)
+ inspect the glyphs of it3.glyph_row, because
+ PRODUCE_GLYPHS will not produce anything for a
+ newline, and thus it3.glyph_row stays at its
+ stale content it got at top of the window. */
+ it3_moved = 0;
/* Finally, advance the iterator until we hit the
first display element whose character position is
CHARPOS, or until the first newline from the
@@ -1452,6 +1462,7 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
if (IT_CHARPOS (it3) == charpos
|| ITERATOR_AT_END_OF_LINE_P (&it3))
break;
+ it3_moved = 1;
set_iterator_to_next (&it3, 0);
}
top_x = it3.current_x - it3.pixel_width;
@@ -1462,7 +1473,8 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
display string, move back over the glyphs
produced from the string, until we find the
rightmost glyph not from the string. */
- if (IT_CHARPOS (it3) != charpos && EQ (it3.object, string))
+ if (it3_moved
+ && IT_CHARPOS (it3) != charpos && EQ (it3.object, string))
{
struct glyph *g = it3.glyph_row->glyphs[TEXT_AREA]
+ it3.glyph_row->used[TEXT_AREA];