changeset 72863:526dc1f36b09

(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.
author Kim F. Storm <storm@cua.dk>
date Thu, 14 Sep 2006 09:37:44 +0000
parents 60248c44abb0
children b3ac65067f69
files src/xdisp.c
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;