From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Jonas Bernoulli <jonas@bernoul.li>
Cc: 19188-done@debbugs.gnu.org
Subject: bug#19188: point adjustemnt moves *into* invisible text
Date: Wed, 26 Nov 2014 09:51:12 -0500 [thread overview]
Message-ID: <jwv61e2jajl.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <87tx1mwtgn.fsf@bernoul.li> (Jonas Bernoulli's message of "Wed, 26 Nov 2014 04:07:04 +0100")
tags 19188 notabug
thanks
> However point is not were the cursor is
> M-: (point) => 3
> The problem is in the code that is supposed to move point *out* of an
> invisible region, does the opposite when moving backward places point
> on the first character after an invisible region. It moves to the
> beginning of the preceding invisible region.
That is a common misunderstanding. The fact that point is equal to
3 means that point is *between* character 2 and character 3. So it's not
*inside* an invisible text, but is right at the boundary.
The position 5 (i.e. between character 4 and character 5) is at the
other end of the boundary.
The reason why Emacs decided to put point at position 3 rather than
leave it at position 5 is because the boundary at position 3 is "less
invisible" than the boundary at position 5.
You can check it with
M-: (list (get-pos-property 3 'invisible) (get-pos-property 5 'invisible)) RET
This is because text-properties by default are front-non-sticky and
rear-sticky, so if point is at position 5 and you type a character, that
character will inherit the invisible property, whereas if you're at
position 3 and you type a character this character will not inherit the
invisible property.
If you want point to be at position 5 rather than position 3, then you
need to change the front/rear-stickiness of this invisible
property accordingly.
> When point adjustment is disabled (non-nil disable-point-adjustment or
> global-disable-point-adjustment) then this does not happen.
I assume you know why ;-)
> It also does not happen when moving forward, e.g. starting at "1"
> C-p C-f places the cursor on "5" *and* point is also 5.
C-p C-f doesn't do it for me (it doesn't even reach the invisible part of the
text), and if I change the recipe to C-f C-f it doesn't work either
(point stays at position 3).
But indeed C-n gets me to position 5, which is wrong (and doing M-: (point)
returns 5 but moves me to position 3, so doing it again returns 3 :-( ).
So we do have a bug here.
Stefan
next prev parent reply other threads:[~2014-11-26 14:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-26 3:07 bug#19188: point adjustemnt moves *into* invisible text Jonas Bernoulli
2014-11-26 14:51 ` Stefan Monnier [this message]
2014-12-22 19:32 ` Jonas Bernoulli
2014-12-23 4:11 ` Stefan Monnier
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=jwv61e2jajl.fsf-monnier+emacsbugs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=19188-done@debbugs.gnu.org \
--cc=jonas@bernoul.li \
/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).