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

From: Eli Zaretskii <[email-masked]>
Date: Mon, 14 Sep 2015 16:33:30 +0300

> Date: Mon, 14 Sep 2015 08:46:57 -0400
> From: Noam Postavsky <[email-masked]>
> Cc: [email-masked]
> 
> On Mon, Sep 14, 2015 at 2:17 AM, Eli Zaretskii <[email-masked]> wrote:
> >
> > Of course: that's a line of text.  Why is that a problem?  (I have no
> > idea what role is that thin line serving in Magit.)
> 
> In this particular case, the overlays are delimiting a "magit region"
> (consisting of whole logical lines touched by Emacs' region). This
> means the thin line has to move with point, staying just ahead of it.

What's wrong with marking the region with some special background
color?

Anyway, if you must use overlays here, by all means do, just try to
avoid newlines in its strings, if you want reliable cursor movement
across that overlay.

Please understand: what you originally perceived as a "bug" was
actually normal Emacs routine of placing point immediately after the
end of the overlay string.  It ended up in column zero because the
overlay string ended in a newline.  If there were no newline, the
problem would not have happened.  We now have special code in
vertical-motion that caters to this specific scenario.  That's why
using such overlay strings should be discouraged: they tend to force
us add similar special-case code all over the place.

> Here is a demo, eval this in a buffer, then do set-mark-command and
> move around a bit:

What am I supposed to see?  I see nothing that I don't see without
this.