unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Cursor positioning with `after-string' overlays
Date: Fri, 02 Apr 2010 21:21:09 -0400	[thread overview]
Message-ID: <jwviq895ocl.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <836349wo57.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 03 Apr 2010 00:16:52 +0300")

>> > The minibuffer completion use-case is different: there, we have no
>> > text that comes from a buffer beyond the place where the cursor is
>> > displayed.  IOW, there're no glyphs to the right of the cursor that
>> > came from the minibuffer.  So there are no buffer positions that
>> > "compete" for the cursor position, only the overlay with the
>> > completion message.
>> I can imagine using the same kind of message for in-buffer completion.
> Then you need to use the "integer as `cursor' property value"
> feature.  I.e., don't just set the property's value non-nil, set it to
> the integer number that specifies how many buffer positions are
> ``covered'' by that cursor positions.  That's what CUA Mode does in
> cua-rect.el.  Integer property values do override the "exact match for
> point always wins" strategy.

Yes, that sounds OK.  But note that (except for when the after-string is
at EOB) there's basically always a "exact match for point", so that
basically means that the use of a value t for the `cursor' property will
simply not work any more and might just be dropped.

>> The position is not enough because we need to find the actual overlay
>> where it came from and there can be several overlays at that buffer
>> position.
> Right, but we have the string, so we could look for the overlay that
> specifies the same string.

Yes, we could, tho of course the same string might be placed on several
overlays at the same buffer position, and we have to check whether it's
on a before-string or an after-string or ...
I.e. it's workable but it'd probably be ugly.

>> But I do not object at all to your general argument "I think this kind
>> of problems should be fixed, not worked around with the `cursor'
>> property".  I seem to remember making the same observation, then jumping
>> to the C code, and finally deciding "too hard for me, I'll live with the
>> workaround for now".  So if you can fix it, that would be great.
> I'd need to see the requirements first.

Just that it places the cursor on the "before" or "after" position of
(after|before|display)-strings depending on the
stickiness/insertion-type of the corresponding overlay/text-property.


        Stefan




  reply	other threads:[~2010-04-03  1:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwviq895ocl.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).