]> git.eshelyaron.com Git - emacs.git/commitdiff
(produce_image_glyph): Automatically crop wide images at
authorKim F. Storm <storm@cua.dk>
Thu, 14 Sep 2006 09:37:44 +0000 (09:37 +0000)
committerKim F. Storm <storm@cua.dk>
Thu, 14 Sep 2006 09:37:44 +0000 (09:37 +0000)
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.

src/xdisp.c

index dbc416afd9ac5307476725e912f0908b8afe5186..6efd095800233ac87bb0bf55d7c28043e4df35ef 100644 (file)
@@ -19786,7 +19786,7 @@ produce_image_glyph (it)
 {
   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 @@ produce_image_glyph (it)
 
   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;