unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Cursor positioning with `after-string' overlays
@ 2010-04-01 13:15 Eli Zaretskii
  2010-04-01 21:54 ` Kim F. Storm
  2010-04-01 22:06 ` Stefan Monnier
  0 siblings, 2 replies; 16+ messages in thread
From: Eli Zaretskii @ 2010-04-01 13:15 UTC (permalink / raw)
  To: emacs-devel

Evaluate the following form in some buffer:

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

This displays "foo-bar", with the "-" coming from the `after-string'
property of the overlay.  Now go to `f' at the beginning of "foo-bar",
type C-f repeatedly, and watch where the cursor is placed when you
type C-f on the second `o' in "foo".  Emacs-23 branch (and Emacs 22)
places the cursor on `-', and jumps over `b' to `a' on the next C-f.
The trunk version, by contrast, jumps from `o' directly to `b', and
then continues to `a' on the next C-f.

The trunk version of the cursor positioning, which was rewritten for
support of bidirectional editing, behaves like that because it always
tries to find an exact match for point, and if found, puts the cursor
on the corresponding glyph.  It only considers positioning the cursor
on glyphs whose position is different if an exact match could not be
found.  IOW, exact match wins over all other considerations.  Since
C-f from the second `o' moves point to buffer position to which `b'
corresponds exactly, that is where the trunk version puts the cursor.

The old version puts the cursor on `-' because it examines the glyphs
from left to right, and finds the glyph with a `cursor' property
_before_ it has a chance to see that `b' has the required character
position.

Does anyone think that the version on the trunk is wrong and the old
one is right?

More generally, what are the use-cases for putting the `cursor'
property on a `before-string' or `after-string' overlay, and what is
expected from cursor positioning in those use-cases?




^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-04-03 10:42 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-01 13:15 Cursor positioning with `after-string' overlays Eli Zaretskii
2010-04-01 21:54 ` Kim F. Storm
2010-04-02  7:53   ` Eli Zaretskii
2010-04-02  8:54     ` Eli Zaretskii
2010-04-02 10:24       ` Kim F. Storm
2010-04-01 22:06 ` Stefan Monnier
2010-04-02  8:16   ` Eli Zaretskii
2010-04-02 18:17     ` Stefan Monnier
2010-04-02 18:38       ` Eli Zaretskii
2010-04-02 20:35         ` Stefan Monnier
2010-04-02 21:16           ` Eli Zaretskii
2010-04-03  1:21             ` Stefan Monnier
2010-04-03  7:26               ` Eli Zaretskii
2010-04-03  7:30               ` redisplay code is ugly (was: Cursor positioning with `after-string' overlays) Eli Zaretskii
2010-04-03 10:42               ` Cursor positioning with `after-string' overlays Eli Zaretskii
2010-04-03 10:28       ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).