bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#11068: 24.0.94; Face-remapped background does not extend to end of w


From: Eli Zaretskii
Subject: bug#11068: 24.0.94; Face-remapped background does not extend to end of window
Date: Fri, 30 Mar 2012 11:18:59 +0300

> Date: Fri, 30 Mar 2012 09:35:20 +0200
> From: martin rudalics <address@hidden>
> CC: address@hidden, address@hidden, 
>  address@hidden, address@hidden
> 
> (defvar my-overlay nil)
> (defvar my-string nil)
> 
> (progn
>    (when (overlayp my-overlay)
>      (delete-overlay my-overlay))
>    (setq my-overlay (make-overlay 0 0))
>    (setq my-string
>       (propertize "      " 'face 'lazy-highlight 'cursor 1))

What are you trying to accomplish by putting the `cursor' property on
more than a single character of the overlay string?  The display
engine doesn't expect it to be on more than one character in the
overlay string (it will put the cursor on the first and ignore the
rest).

> Evaluating this and moving `point' between buffer positions 336 and 337
> oscillates the cursor around the overlay.  If I instead use the line
> 
>       (propertize "      " 'face 'lazy-highlight 'cursor 2))
> 
> in the above and reevaluate, moving `point' doesn't oscillate the cursor
> any more.  But if I additionally replace the last line as
> 
>    (move-overlay my-overlay (- (point-max) 2) (point-max)))
> 
> the cursor oscillates again (but now between positions 335 and 337).
> 
> I find the behavior good but am too silly to understand what's going on.
> What do I really specify when I write a form like
> 
>       (propertize "      " 'face 'lazy-highlight 'cursor 1))
> 
> Apparently the "1" doesn't refer to a position within the "      " but
> to some position within the buffer from (- (point-max) 1) (point-max))
> where that string is eventually placed by the overlay movement.

The string character on which you put the `cursor' property of any
non-nil value is the character where you want the cursor displayed.
The value says for which buffer positions to display the cursor
there.  If the value is an integer number, the cursor is displayed
there when the buffer position is between N and N + n, where n is the
value of the property and N is the overlay-start position.  If the
value is anything else and non-nil, the cursor is displayed there only
when point is at overlay-start.

>  > this feature in action in cua-rectangle; after you play with it,
>  > perhaps you could suggest how to improve the documentation.
> 
> IIUC in the Emacs sources the 'cursor property is never used in
> connection with overlays.

??? I clearly see it in this snippet from cua-rect.el:

                     (if (cua--rectangle-right-side)
                         (put-text-property (1- (length ms)) (length ms) 
'cursor 2 ms) <<<<<<<<<<<
                       (put-text-property 0 1 'cursor 2 ms)) <<<<<<<<<<<<<
                     (setq bs (concat bs ms)) <<<<<<<<<<<<<<<<
                     (setq rface nil))
                    (t
                     (setq as (propertize
                               (make-string
                                (- r cr0 (if (= le pr) 1 0))
                                (if cua--virtual-edges-debug ?~ ?\s))
                               'face rface))
                     (if (cua--rectangle-right-side)
                         (put-text-property (1- (length as)) (length as) 
'cursor 2 as) <<<<<<<<<<<
                       (put-text-property 0 1 'cursor 2 as)) <<<<<<<<<<<<<
                     (if (/= pr le)
                         (setq e (1- e))))))))
             ;; Trim old leading overlays.
             (while (and old
                         (setq overlay (car old))
                         (< (overlay-start overlay) s)
                         (/= (overlay-end overlay) e))
               (delete-overlay overlay)
               (setq old (cdr old)))
             ;; Reuse an overlay if possible, otherwise create one.
             (if (and old
                      (setq overlay (car old))
                      (or (= (overlay-start overlay) s)
                          (= (overlay-end overlay) e)))
                 (progn
                   (move-overlay overlay s e)
                   (setq old (cdr old)))
               (setq overlay (make-overlay s e)))
             (overlay-put overlay 'before-string bs)  <<<<<<<<<<<<<<<
             (overlay-put overlay 'after-string as)   <<<<<<<<<<<<<<<

In general, this feature was invented (By Kim Storm) specifically for
his cua-rect wizardry.





reply via email to

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