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: Fri, 02 Oct 2015 13:01:06 +0300

> Date: Thu, 1 Oct 2015 16:43:11 -0400
> From: Noam Postavsky <npostavs@users.sourceforge.net>
> Cc: 21468@debbugs.gnu.org
> 
> > I think you should be able to extend the face by using a display
> > property with :align-to value.  The value should be computed to go all
> > the way to the edge of the window.
> 
> We tried something like this:
> 
> (let ((align `(space :align-to (+ (,(window-body-width nil t))
>                                   ,(window-hscroll)))))
>   (ov rbeg eol 'face (list :overline color)
>       'after-string (propertize "\s" 'face face 'display align)))
> 
> But when moving point to end of line this causes the cursor to appear
> at the edge of the window instead of at the "real" end of line. I
> guess it's because the aligned space pushes the newline character to
> the edge of the window.

Yes.  But why is that a problem?

If you dislike that, you could make the stretch one column shorter,
like this:

  (let* ((align (list 'space :align-to `(+ (,(- (window-body-width nil t)
                                                (default-font-width)))
                                           ,(window-hscroll))))

(Btw, I think adding window-hscroll is incorrect here, as its value is
in columns, while window-body-width returns the width in pixels.)

> > I cannot do anything about these issues besides explaining how they
> > harm Emacs maintenance, and asking people to look for alternative
> > solutions.
> 
> Well you *could* refuse to fix bugs like this, i.e. declare that
> creating overlays with newlines invokes undefined behaviour.

I could, but I consider that a "doomsday weapon", hopefully never to
be used in Emacs development, certainly not by me.  I don't think it
was ever done.





reply via email to

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