[Top][All Lists]

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

face vs. mouse-face text property

From: Michael Heerdegen
Subject: face vs. mouse-face text property
Date: Wed, 18 Jan 2012 22:34:32 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)


I recognized that the area highlighted when using a mouse-face is
different from that when using the face text property when the
propertized string includes newlines.  For example, try that:

(with-current-buffer (generate-new-buffer "test")
  (pop-to-buffer (current-buffer))
  (let ((o1 (make-overlay (point) (progn (insert "\n\n") (point)))))
    (overlay-put o1 'face 'highlight))
  (insert "\n--\n")
  (let ((o2 (make-overlay (point) (progn (insert "\n\n") (point)))))
    (overlay-put o2 'mouse-face 'highlight)))

While the first overlay is visible, you see nothing at all when you move
the mouse over the second overlay.  If you try this:

(with-current-buffer (generate-new-buffer "test")
  (pop-to-buffer (current-buffer))
  (let ((o1 (make-overlay (point) (progn (insert "\ntext\n") (point)))))
    (overlay-put o1 'face 'highlight))
  (insert "\n--\n")
  (let ((o2 (make-overlay (point) (progn (insert "\ntext\n") (point)))))
    (overlay-put o2 'mouse-face 'highlight)))

the first newline in the second overlay gets highlighted when you move
the mouse over it, but not the second newline char.

My question is: is this a bug, or intended behavior?  If it is intended,
why, and is there a way to get the mouse highlighting nevertheless work
or to override the default behavior?  In my scenario, it is important
that the mouse-face works also for strings consisting of newlines, to
indicate that it's clickable text.



reply via email to

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