Subject: bug#26: Consistent underline face end of line to edge extension on X

From: David De La Harpe Golden <[email-masked]>
Date: Tue, 04 Mar 2008 02:25:13 +0000

David De La Harpe Golden wrote:

> (i) N.B. Extension happens anyway, if the background happens to be
> different to the frame background 

Anyway, if you do consider it a bug that that extension happens, then
just making underline and overline drawing use width rather than
background_width (like overstrike) in src/xterm.c probably resolves
that? (at least on bitmapped displays)

Illustrative screenshots included - note how a nonmatching background
causes the ugly (in this context) extension.

Index: src/xterm.c
===================================================================
RCS file: /sources/emacs/emacs/src/xterm.c,v
retrieving revision 1.981
diff -u -r1.981 xterm.c
--- src/xterm.c	3 Mar 2008 06:32:12 -0000	1.981
+++ src/xterm.c	4 Mar 2008 02:12:58 -0000
@@ -2978,14 +2978,14 @@
 
 	  if (s->face->underline_defaulted_p)
 	    XFillRectangle (s->display, s->window, s->gc,
-			    s->x, y, s->background_width, h);
+			    s->x, y, s->width, h);
 	  else
 	    {
 	      XGCValues xgcv;
 	      XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
 	      XSetForeground (s->display, s->gc, s->face->underline_color);
 	      XFillRectangle (s->display, s->window, s->gc,
-			      s->x, y, s->background_width, h);
+			      s->x, y, s->width, h);
 	      XSetForeground (s->display, s->gc, xgcv.foreground);
 	    }
 	}
@@ -2997,14 +2997,14 @@
 
 	  if (s->face->overline_color_defaulted_p)
 	    XFillRectangle (s->display, s->window, s->gc, s->x, s->y + dy,
-			    s->background_width, h);
+			    s->width, h);
 	  else
 	    {
 	      XGCValues xgcv;
 	      XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
 	      XSetForeground (s->display, s->gc, s->face->overline_color);
 	      XFillRectangle (s->display, s->window, s->gc, s->x, s->y + dy,
-			      s->background_width, h);
+			      s->width, h);
 	      XSetForeground (s->display, s->gc, xgcv.foreground);
 	    }
 	}