unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Vitalie Spinu <spinuvit@gmail.com>
Cc: 21368@debbugs.gnu.org
Subject: bug#21368: 25.0.50; Core navigation commands fail in a multi-line intangible text with	fringe
Date: Fri, 28 Aug 2015 22:45:47 +0300	[thread overview]
Message-ID: <83r3mn2o44.fsf@gnu.org> (raw)
In-Reply-To: <87r3mnjtzl.fsf@gmail.com>

> From: Vitalie Spinu <spinuvit@gmail.com>
> Date: Fri, 28 Aug 2015 17:46:54 +0200
> 
>  (defun insert-with-fringe ()
>    (insert
>     "      "
>     (concat
>      (propertize "fringe" 'display (list 'left-fringe 'filled-square font-lock-doc-face))
>      (propertize "dummy" 'display "AAA\n" 'font-lock-face font-lock-doc-face))
>     "some more text")
>    (previous-line))
> 
> Execute (insert-with-fringe). It should position the cursor just in front of the
> "AAA" string.
> 
> Now (backward-char 1) or (goto-char (1- (point))) don't have any effect, and
> (previous-line) goes to bol instead of the previous line.

The first two do work, you just need to invoke backward-char twice to
see the cursor move.  But "C-x =" will show you that backward-char did
move even after the first time.  The cursor doesn't move the first
time because you have buffer positions covered by a display property
that is displayed on the fringe, and the first backward-char moves
into those buffer positions.  This is nothing new: you can see it
whenever you use the fringe property without all the rest in this
scenario.  So this part of the behavior is not a bug.

The behavior of previous-line is indeed a bug, and it is hard to fix.

> It has to do with the trailing "\n" in "AAA\n". If that new line is removed,
> everything works as expected.

No, it's because you have 2 consecutive display properties, _and_ the
second one ends in a newline.  There's code in vertical-motion that
attempts to avoid the lossage when a display property includes
newlines, but the fringe display property before that defeats that
code.

Is there some important real-life use case that needs this to work?
Otherwise, I'm inclined to leave this alone.  After all, it's not a
catastrophe: the next call to previous-line will go to the line you
want.





  reply	other threads:[~2015-08-28 19:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-28 15:46 bug#21368: 25.0.50; Core navigation commands fail in a multi-line intangible text with fringe Vitalie Spinu
2015-08-28 19:45 ` Eli Zaretskii [this message]
2015-08-28 22:02   ` Vitalie Spinu
2015-08-29  7:25     ` Eli Zaretskii
2015-08-29 19:08       ` Vitalie Spinu
2015-08-29 19:17         ` Vitalie Spinu
2015-08-29 20:14           ` Eli Zaretskii
2015-08-29 20:11         ` Eli Zaretskii
2015-08-29 15:23     ` Wolfgang Jenkner
2015-08-29 19:11       ` Vitalie Spinu
2015-08-29 21:53         ` Wolfgang Jenkner
2015-08-30 11:46           ` Vitalie Spinu
2015-08-30 12:55             ` Wolfgang Jenkner
2015-08-30 15:02               ` Eli Zaretskii
2015-08-30 15:11                 ` Wolfgang Jenkner
2015-08-31 12:54                   ` Wolfgang Jenkner

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=83r3mn2o44.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=21368@debbugs.gnu.org \
    --cc=spinuvit@gmail.com \
    /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).