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

From: David De La Harpe Golden <[email-masked]>
Date: Mon, 03 Mar 2008 00:05:04 +0000

Package: emacs
Version: 23.0.60
Severity: minor
Tags: patch

As per emacs-devel post [1]

On X displays, when an overlay's face has underline (or overstrike
or strikethrough) set, when it crosses line end, it is only extended
to window edge when a background different to the frame background is
also set in the face.  This is different behaviour to terminal displays.

It really only matters for "unconventional" uses of
underline/overline/strikethrough through, such as use in a "show old
window position" hack [2][3]

Easily "fixed", patch attached.

[1] http://lists.gnu.org/archive/html/emacs-devel/2008-03/msg00071.html
[2] http://lists.gnu.org/archive/html/emacs-devel/2008-02/msg03044.html
[3] http://lists.gnu.org/archive/html/emacs-devel/2008-02/msg03045.html

Index: src/xdisp.c
===================================================================
RCS file: /sources/emacs/emacs/src/xdisp.c,v
retrieving revision 1.1198
diff -u -r1.1198 xdisp.c
--- src/xdisp.c	29 Feb 2008 03:12:27 -0000	1.1198
+++ src/xdisp.c	2 Mar 2008 04:42:46 -0000
@@ -15968,6 +15968,9 @@
   if (FRAME_WINDOW_P (f)
       && it->glyph_row->displays_text_p
       && face->box == FACE_NO_BOX
+      && !face->underline_p
+      && !face->overline_p
+      && !face->strike_through_p
       && face->background == FRAME_BACKGROUND_PIXEL (f)
       && !face->stipple)
     return;
Index: src/xterm.c
===================================================================
RCS file: /sources/emacs/emacs/src/xterm.c,v
retrieving revision 1.980
diff -u -r1.980 xterm.c
--- src/xterm.c	1 Mar 2008 14:59:06 -0000	1.980
+++ src/xterm.c	2 Mar 2008 04:42:56 -0000
@@ -3024,7 +3024,7 @@
 	      XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
 	      XSetForeground (s->display, s->gc, s->face->strike_through_color);
 	      XFillRectangle (s->display, s->window, s->gc, s->x, s->y + dy,
-			      s->width, h);
+			      s->background_width, h);
 	      XSetForeground (s->display, s->gc, xgcv.foreground);
 	    }
 	}