emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#129: Mouse highlighting fails for font sizes.


From: Chong Yidong
Subject: Re: bug#129: Mouse highlighting fails for font sizes.
Date: Thu, 10 Apr 2008 21:51:38 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Chong Yidong <address@hidden> writes:

> At some point, the Unicode-2 branch redisplay was changed to allow
> mouse-highlighted text to have a different font size from the
> unhighlighted characters.  Unfortunately, this doesn't mesh well with
> the existing code in note_mouse_highlight, which assumes the highlighted
> glyphs overlap exactly with unhighlighted glyphs.
>
> (defface foo-face
>   '((t :height 1.5))
>   "Face")
>
> (defface bar-face
>   '((t :height 1.0))
>   "Face")
>
> (defun foo-test ()
>   (interactive)
>   (switch-to-buffer "*Test*")
>   (erase-buffer)
>   (insert "Copying Conditions")
>   (put-text-property (point-min) (point-max) 'face 'foo-face)
>   (put-text-property (point-min) (point-max) 'mouse-face '(bar-face 
> highlight)))

After thinking some more, I think it's problematic to let
mouse-highlighted text differ in size from the unhighlighted characters.
Even if we fix the redisplay engine to correctly update the glyph row in
such situations, there's the problem of how to decide when to perform
highlighting.

Consider a buffer containing the letters "A B" in a big font, which I
schematically depict as

 -A- -B-

Suppose the letter A has a mouse highlight face that contains a small
font.  So if we put the cursor over it, in the position marked ^, we see

 A -B-
 ^

Now, move the cursor slightly to the right, so that it moves off the
highlighted A:

 A -B-
  ^

The highlighting disappears, and we see

 -A- -B-
  ^

But the mouse is now again on the letter A, which means we need to
highlight!

Is the benefit of allowing a different-sized mouse-face significant?  If
not, I propose imposing (or restoring) the restricting that only the
foreground-color and background-color of the mouse-face takes effect;
all other properties are ignored, and taken from the underlying face.

What do you think?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]