# HG changeset patch # User Kim F. Storm # Date 1158226664 0 # Node ID 526dc1f36b0969f73dadac449e889117b63b1afb # Parent 60248c44abb0c643604022d4af3fb5dc90688f9d (produce_image_glyph): Automatically crop wide images at right window edge so we can draw the cursor on the same row to avoid confusing redisplay by placing the cursor outside the visible window area. diff -r 60248c44abb0 -r 526dc1f36b09 src/xdisp.c --- a/src/xdisp.c Thu Sep 14 09:37:29 2006 +0000 +++ b/src/xdisp.c Thu Sep 14 09:37:44 2006 +0000 @@ -19786,7 +19786,7 @@ { struct image *img; struct face *face; - int glyph_ascent; + int glyph_ascent, crop; struct glyph_slice slice; xassert (it->what == IT_IMAGE); @@ -19894,6 +19894,15 @@ take_vertical_position_into_account (it); + /* Automatically crop wide image glyphs at right edge so we can + draw the cursor on same display row. */ + if ((crop = it->pixel_width - (it->last_visible_x - it->current_x), crop > 0) + && (it->hpos == 0 || it->pixel_width > it->last_visible_x / 4)) + { + it->pixel_width -= crop; + slice.width -= crop; + } + if (it->glyph_row) { struct glyph *glyph;