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

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

bug#5809: 23.1.94; cross-reference by anchor yields in accurate position


From: Eli Zaretskii
Subject: bug#5809: 23.1.94; cross-reference by anchor yields in accurate position
Date: Sun, 04 Apr 2010 15:12:11 +0300

> From: Juri Linkov <juri@jurta.org>
> Cc: monnier@iro.umontreal.ca,  5809@debbugs.gnu.org
> Date: Sun, 04 Apr 2010 14:07:28 +0300
> 
> >> There are still a problem.  I can't find a way to move the cursor
> >> inside the overlay's after-string and click links inside it.
> >> Any suggestions?
> >
> > Does it work to change the character of the overlay string on which
> > you put the `cursor' property?  (You will need to redefine C-f, C-b,
> > and friends for that.)
> 
> Sorry, I don't understand what do you mean.  Could you modify the example
> you recently sent to emacs-devel:
> 
>     (let ((pos (goto-char (point-max))))
>       (insert "foobar")
>       (overlay-put
>       (make-overlay (+ pos 2) (+ pos 3))
>       'after-string (propertize "-" 'cursor t)))
> 
> to allow the cursor to move inside 'after-string and to not jump over it?

Compare the results of evaluating the two forms below:

    (let ((pos (goto-char (point-max))))
      (insert "foobar")
      (overlay-put
        (make-overlay (+ pos 2) (+ pos 3))
        'after-string (concat "1" (propertize "2" 'cursor t) "34")))


    (let ((pos (goto-char (point-max))))
      (insert "foobar")
      (overlay-put
        (make-overlay (+ pos 2) (+ pos 3))
        'after-string (concat "12" (propertize "3" 'cursor t) "4")))

Both display "foo1234bar", with "1234" coming from the `after-string'
overlay.

When you type C-f on the second `o' in "foo", the cursor will be
displayed on `2' with the first form and on `3' with the second.  More
generally, the cursor will be displayed on the character in "1234"
which you propertize with a non-nil `cursor' property.

What I meant in my suggestion is to move the property from one
character to another of the `after-string' when the user types C-f
with cursor on the overlay.  E.g., if the cursor is on `2' and I type
C-f, modify the `after-string' from

     (concat "1" (propertize "2" 'cursor t) "34")
to
     (concat "12" (propertize "3" 'cursor t) "4")

Then it will appear as if the cursor moved inside the `after-string'.






reply via email to

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