[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Christopher J. White
Fri, 4 May 2001 18:28:36 -0500 (EST)
In GNU Emacs 20.7.1 (i386-*-windows98.2222)
of Tue Jun 13 2000 on buffy
configured using `configure NT'
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:
Overlays do not always properly handle faces and mouse events
when using before-string and after-string properties.
I've noticed a number following problems (not all of which
are necessarily bugs, but seem inconsistent). I've included
some sample code that illustartes these problems
in 4 simple tests.
1. Setting the 'face' property of an overlay causes only the overlay
text and the 'after-string' to be properly displayed with the
given face. The 'before-string' is not changed. (tests 1 & 2)
2. The 'mouse-face' works inconsistently for the the 'before-string'
and 'after-string'. When moving the mouse into the overlay I get
various results (test1):
- Moving the mouse over the 'before-string' causes a face change
to 'mouse-face', but not 'after-string'.
- When a face change occurs, sometimes the before-string or the
after-string is not faced. The overlay text is always faced
properly. In other words, using ^ to delinate what is faced,
with before-string '===>', text 'test1', after-string '<===',
here are the three possibilities:
^===>text<===^ the correct way?
^===>text^<=== after-string missed
===>^text<===^ before-string missed
I've been unable to determine a pattern as to which will work.
Sometimes, just leaving the mouse in the region and moving the cursor
causes it to toggle between the second two options.
3. If the overlay text starts at the beginning of a line, moving
the mouse anywhere in the overlay region (or before/after-strings)
does nothing. The mouse-face is never displayed. If you insert
a newline somewhere in the overlay region, it works fine. test2
illustrates this problem, whereas test3 shows that without the
before-string, things work fine.
4. If the overlay property 'invisible' is used, the change to
mouse-face of the before and after-strings is even more erradic,
sometimes showing before plus the first character of after. (test4)
5. Using local-map to bind a function mouse-2 inside the overlay
works only some of the time.
- Clicking mouse-2 over before-string or the overlay text
calls the overlay function. Clicking over after-string
does not. This even works for test2 even though mouse-face
is not displayed. (tests 1-3)
- Combined with invisible, only clicking on the first character
of before-string works. Clicking on any other character
of before-string or any charachter of after-string does not
call the overlay function. (test4)
;; To run the test, eval these to defuns, then execute overlay-test.
;; This will popup the *overlay-test* buffer in the other window.
;; Move the mouse over the various regions delineated by the
;; before-string "===>" and the after-string "<===", except for
;; test3 for which the before and after-strings are not added to the
;; In addition, click mouse-2 over various points in and out of the
;; the overlays. A success yields a "Hit" message in the message
;; area. A fail yields "Miss".
(set-buffer (get-buffer-create "*overlay-test*"))
(insert "This is test1\n\ntest2 down here.\n\ntest3 looks similar\n\nFinally
test4 is here.")
(overlay-run-test "test1" t nil)
(overlay-run-test "test2" t nil)
(overlay-run-test "test3" nil nil)
(overlay-run-test "test4" t t)
(local-set-key [mouse-2] (lambda () (interactive) (message "Miss")))
(defun overlay-run-test (string before-after invisible)
(let (o (m (make-sparse-keymap)))
(setq o (make-overlay (match-beginning 0) (match-end 0)))
(overlay-put o 'face 'bold)
(overlay-put o 'invisible invisible)
(overlay-put o 'mouse-face 'highlight)
(define-key m [mouse-2] (lambda () (interactive) (message "Hit")))
(overlay-put o 'local-map m)
(overlay-put o 'before-string "===>")
(overlay-put o 'after-string "<===")
|[Prev in Thread]
||[Next in Thread]|
- Overlay problems,
Christopher J. White <=