summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dispnew.c5
-rw-r--r--src/xdisp.c11
2 files changed, 15 insertions, 1 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index 6b39c12f910..56f125218dc 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5214,6 +5214,11 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
#ifdef HAVE_WINDOW_SYSTEM
if (it.what == IT_IMAGE)
{
+ /* Note that this ignores images that are fringe bitmaps,
+ because their image ID is zero, and so IMAGE_OPT_FROM_ID will
+ return NULL. This is okay, since fringe bitmaps are not
+ displayed in the text area, and so are never the object we
+ are interested in. */
img = IMAGE_OPT_FROM_ID (it.f, it.image_id);
if (img && !NILP (img->spec))
*object = img->spec;
diff --git a/src/xdisp.c b/src/xdisp.c
index d2bb47fdabd..fd8aad04121 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -8775,7 +8775,16 @@ move_it_in_display_line_to (struct it *it,
if (it->line_wrap == TRUNCATE)
{
- if (BUFFER_POS_REACHED_P ())
+ /* If it->pixel_width is zero, the last PRODUCE_GLYPHS call
+ produced something that doesn't consume any screen estate
+ in the text area, so we don't want to exit the loop at
+ TO_CHARPOS, before we produce the glyph for that buffer
+ position. This happens, e.g., when there's an overlay at
+ TO_CHARPOS that draws a fringe bitmap. */
+ if (BUFFER_POS_REACHED_P ()
+ && (it->pixel_width > 0
+ || IT_CHARPOS (*it) > to_charpos
+ || it->area != TEXT_AREA))
{
result = MOVE_POS_MATCH_OR_ZV;
break;