GNU bug report logs - #21468
24.5; When next-line (visual) crosses overlay with before-string="\n" point goes to column 0

Previous Next

Package: emacs;

Reported by: Noam Postavsky <npostavs <at> users.sourceforge.net>

Date: Sun, 13 Sep 2015 05:18:01 UTC

Severity: normal

Found in version 24.5

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Subject: bug#21468: closed (Re: bug#21468: 24.5; When next-line (visual)
 crosses overlay with before-string="\n" point goes to column 0)
Date: Sun, 13 Sep 2015 17:21:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#21468: 24.5; When next-line (visual) crosses overlay with before-string="\n" point goes to column 0

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 21468 <at> debbugs.gnu.org.

-- 
21468: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21468
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 21468-done <at> debbugs.gnu.org
Subject: Re: bug#21468: 24.5; When next-line (visual) crosses overlay with
 before-string="\n" point goes to column 0
Date: Sun, 13 Sep 2015 13:20:04 -0400
On Sun, Sep 13, 2015 at 6:30 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> Fixed in commit 6514b30 on master.

Thanks, it works.

> why can't Magit simply change the buffer text to be what it wants to
> display? why does it need to use an overlay string?

In this particular case, the overlays are delimiting a "magit region"
(consisting of whole logical lines touched by Emacs' region), having
them as actual text in the buffer would interfere with point movement
even more.

Or at least, that's what I saw when I tried just now to do something
similar with text properties:

(with-current-buffer (get-buffer-create "*text property test*")
  (erase-buffer)
  (insert-file "next-line-fail.el")
  (let ((pos 65))
    (goto-char pos)
    (insert (propertize (concat (propertize "\s" 'display '(space :height (1)))
                        (propertize "\n" 'line-height t))
                        'face 'highlight))
    (pop-to-buffer (current-buffer))))

[Message part 3 (message/rfc822, inline)]
From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.5; When next-line (visual) crosses overlay with before-string="\n"
 point goes to column 0
Date: Sun, 13 Sep 2015 01:17:39 -0400
Run

    emacs -Q next-line-fail.el -l next-line-fail.el

where next-line-fail.el contains

(let ((pos 17))
  (goto-char pos)
  (overlay-put (make-overlay pos (1+ pos)) 'before-string
               (propertize "\n" 'face 'highlight)))

The overlay will create a highlighted blank line below line 1.
Move point forward so it's on line 1, column X (where X != 0), then do
C-n (next-line).

Expected: point should be on line 2 column X.
Actual: point goes to line 2, but in column 0.  Note that hitting C-n
a second time goes to line 3 column X.

The problem does not happen with (setq line-move-visual nil).

I've reproduced this in GUI and terminal.

This is a simplification from a magit bug
https://github.com/magit/magit/issues/2094



This bug report was last modified 9 years and 285 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.