unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Extending underline/overline/strikethrough to window edge on X
@ 2008-03-02  4:52 David De La Harpe Golden
  2008-03-03  0:32 ` David De La Harpe Golden
  0 siblings, 1 reply; 2+ messages in thread
From: David De La Harpe Golden @ 2008-03-02  4:52 UTC (permalink / raw)
  To: Miles Bader
  Cc: Lennart Borgman (gmail), Tassilo Horn, David O'Toole,
	Stefan Monnier, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]

On 02/03/2008, David De La Harpe Golden
<david.delaharpe.golden@gmail.com> wrote:
> Working on that, noticed a difference between underlining on X and in
>  terminals: if a face has only underline set on a terminal and the
>  overlay with that face passes the narrower-than-window-width line end,
>  then the underline extends to the right edge of the window - in this
>  case desirable to get a line all the way across the window.
>
>  If a face has only underline set on X, that doesn't happen,
>  only happens if the face also has a different background set to the
>  frame background.
>
>  Not really up to speed on the C code, but I guess to fix the issue
>  xdisp.c/extend_face_to_end_of_line() probably just needs a small
>  change to extend if underline is set, not just boxes, different
>  backgrounds and stipples.
>

Anyhow,

attached trivial patch fixes issue (and for overline and strikethrough too),
assuming it is an issue.

Note that the underline/overline was always drawn to edge if the
background happened to be different, so this only changes the
behaviour from existing behaviour when the face background is unset or
happens to match the frame background.  As such, it improves
consistency IMO.

strikethrough is a slightly different matter - unlike underline/overline it was
using the width not the background_width when drawn, but for
consistency it probably should use the same.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: xdisp_extend_underline_to_edge.diff --]
[-- Type: text/x-diff; name=xdisp_extend_underline_to_edge.diff, Size: 1224 bytes --]

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);
 	    }
 	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Extending underline/overline/strikethrough to window edge on X
  2008-03-02  4:52 Extending underline/overline/strikethrough to window edge on X David De La Harpe Golden
@ 2008-03-03  0:32 ` David De La Harpe Golden
  0 siblings, 0 replies; 2+ messages in thread
From: David De La Harpe Golden @ 2008-03-03  0:32 UTC (permalink / raw)
  To: David De La Harpe Golden
  Cc: Lennart Borgman (gmail), emacs-devel, David O'Toole,
	Stefan Monnier, Tassilo Horn, Miles Bader

David De La Harpe Golden wrote:
> On 02/03/2008, David De La Harpe Golden
> <david.delaharpe.golden@gmail.com> wrote:
>> Working on that, noticed a difference between underlining on X and in
>>  terminals: if a face has only underline set on a terminal and the
>>  overlay with that face passes the narrower-than-window-width line end,
>>  then the underline extends to the right edge of the window - in this
>>  case desirable to get a line all the way across the window.
>>
>>  If a face has only underline set on X, that doesn't happen,
>>  only happens if the face also has a different background set to the
>>  frame background.

filed as bug #26 in test tracker, including the trivial fix.
http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=26





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-03-03  0:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-02  4:52 Extending underline/overline/strikethrough to window edge on X David De La Harpe Golden
2008-03-03  0:32 ` David De La Harpe Golden

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).