I want to put an overlay at the top of a buffer and display several
lines of text there. I use an overlay of length 1 at point 1 with a
'before-string property to do this.
Doing this I see some strange display problems when moving point to the
beginning of buffer. When (point) is 1 I want the cursor to be displayed
after the 'before-string. And as a pessimist I fear that it might be
displayed before the 'before-string.
However none of these alternatives happen. Instead the cursor is
displayed at the end of the first line of the 'before-string.
To reproduce the problem eval this code and go to the beginning of the
buffer:
(defvar temp-ovl nil)
(defun temp-toggle-ovl()
(interactive)
(if temp-ovl
(progn
(delete-overlay temp-ovl)
(setq temp-ovl nil))
(setq temp-ovl (make-overlay 1 1))
(let ((s "A string\nwith several rows\nthat should be at top\n")
(put-text-property 0 (length s)
'face (list (cons 'background-color
"yellow"))
s)
(overlay-put temp-ovl 'before-string s))))
I have attached an image display the cursor at point 1.
In GNU Emacs 22.0.97.1 (i386-mingw-nt5.1.2600)
of 2007-04-09