bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21468: 24.5; When next-line (visual) crosses overlay with before-str


From: Eli Zaretskii
Subject: 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:30:52 +0300

> Date: Sun, 13 Sep 2015 01:17:39 -0400
> From: Noam Postavsky <npostavs@users.sourceforge.net>
> 
> 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.

Fixed in commit 6514b30 on master.

Once again, I must respectfully request that Magit maintainers refrain
from these practices of (ab)using Emacs display features where simpler
alternatives are readily available.  The buffer displayed by Magit is
entirely ephemeral, i.e. does not come from any file, so a much
simpler way would be to arrange the text in that buffer as Magit
needs, instead of using overlays and display strings to show something
that is not in the buffer.

E.g., in this fragment, cited by the Magit issue:

  (ov rend (1+ rend) 'after-string
      (propertize (concat (propertize "\s" 'display '(space :height (1)))
                          (propertize "\n" 'line-height t))
                  'face 'magit-diff-lines-boundary)))

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?  All those text
properties are supported on buffer text as well.  Overlay strings and
display strings with embedded newlines are especially painful wrt
vertical cursor motion; changing the buffer text instead to present
the same display makes vertical motion's job much simpler.

The Emacs display engine was not designed for too heavy use of these
features.  By over-using them, you make Magit much less stable than
necessary, certainly much less future-proof and consistent across
different Emacs releases.  Please don't.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]