From: Eli Zaretskii <eliz@gnu.org>
To: Alp Aker <aker@pitt.edu>
Cc: 8627@debbugs.gnu.org
Subject: bug#8627: 24.0.50: cursor property behaves irregularly in before-strings
Date: Fri, 06 May 2011 14:03:34 +0300 [thread overview]
Message-ID: <831v0cm6pl.fsf@gnu.org> (raw)
In-Reply-To: <Pine.GSO.4.63.1105051941210.27255@unixs1.cis.pitt.edu>
> Date: Thu, 05 May 2011 20:01:00 -0400 (EDT)
> From: Alp Aker <aker@pitt.edu>
>
> The documentation for the cursor property (info node "(elisp) Special
> Properties") states that:
>
> "Normally, the cursor is displayed at the end of any overlay and text
> property strings present at the current buffer position. You can place
> the cursor on any desired character of these strings by giving that
> character a non-`nil' `cursor' text property."
>
> And then follows the description of using integer values for the cursor
> property to make it applicable to a range of buffer positions other than
> the range between the overlay's start and end.
Note that, crucially, the before-string and after-string properties
are not described in this section. They are described elsewhere,
where the `cursor' property is not mentioned. So I wonder if the
`cursor' property was really supposed to work with before-strings and
after-strings...
> However, when used with overlay before-strings (or after-strings), the
> cursor property appears to behave in ways that aren't consonant with the
> docs and that don't follow a consistent pattern.
It looks like it was never supported consistently, ever since the
`cursor' property was introduced (in Emacs 22.1).
> (1) Insert some boilerplate text to interact with.
>
> (save-excursion
> (goto-char (point-min))
> (insert "Lorem ipsum dolor sit amet.\n"))
>
> Make an overlay and give it a before-string with a non-nil cursor property
> on one character:
>
> (setq olay (make-overlay 5 6)
> str1 (concat "XX"
> (propertize "Y" 'cursor t)
> "ZZ"))
> (overlay-put olay 'before-string str1)
>
> If one now does:
>
> (goto-char (overlay-start olay))
>
> the cursor property is ignored; the cursor appears after the
> before-string.
This works as expected in Emacs 23, so it must be some problem with
the bidi-aware redisplay in Emacs 24. I will take a look when I have
time; thanks for a clear test case.
> (3) But if the before-string contains a newline, the cursor property
> appears to be ignored regardless of location and regardless of whether the
> value of the cursor property is numeric or merely non-nil.
This never worked, I tested it in Emacs 22.1, and it behaves like this
as well.
I will take a look at fixing this, bat can you show a real-life use
case where this is needed?
> I started to read through xdisp.c to make some sense of this, but I'm too
> new to Emacs's internals to be able to follow much of the display routine.
> I did observe, though, that cursor_row_p only checks display properties,
> and doesn't appear to check before-strings and after-strings.
It may come as a surprise, but the implementation of display
properties is very different from that of before-string and
after-string properties. It's a small wonder they don't behave
similarly.
> In any case, it would appear that either the treatment of before-strings
> and after-strings should be changed so that the cursor property works with
> them as it does with strings that come from display properties, or the
> documentation should be amended to make clear that that it can't be
> expected to do so. (In the latter case, it would still seem desirable
> that cursor properties in before- and after-strings behave systematically,
> which isn't currently the case.)
It sounds like it works in most use cases, so fixing the
implementation is probably a better alternative.
next prev parent reply other threads:[~2011-05-06 11:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-06 0:01 bug#8627: 24.0.50: cursor property behaves irregularly in before-strings Alp Aker
2011-05-06 11:03 ` Eli Zaretskii [this message]
2011-05-06 13:53 ` Stefan Monnier
2011-05-06 21:17 ` Alp Aker
2011-05-07 7:26 ` Eli Zaretskii
2011-05-29 20:54 ` Eli Zaretskii
2021-12-04 20:22 ` Lars Ingebrigtsen
2021-12-04 20:44 ` Eli Zaretskii
2021-12-05 14:42 ` 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=831v0cm6pl.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=8627@debbugs.gnu.org \
--cc=aker@pitt.edu \
/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).