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

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

bug#12401: scroll-preserve-screen-position broken with font height faces


From: Eli Zaretskii
Subject: bug#12401: scroll-preserve-screen-position broken with font height faces
Date: Wed, 12 Sep 2012 19:48:59 +0300

> Date: Wed, 12 Sep 2012 10:08:48 +0200
> From: martin rudalics <rudalics@gmx.at>
> CC: Stefan Monnier <monnier@iro.umontreal.ca>, 12401@debbugs.gnu.org, 
>  l26wang@gmail.com
> 
>  >>> scroll-preserve-screen-position?  Is it just that doing N C-v's
>  >>> followed by N M-v's brings point to the same location where it was
>  >>> before this sequence of 2N commands?
>  >> I think this should be the main point, yes.
>  >
>  > For this to work, we would need to make sure that C-v followed by M-v
>  > end up with a window that has the same window-start as the one before
>  > C-v.
> 
> Why?

Because all scroll-preserve-screen-position does is put point on
certain window-relative pixel coordinates.  For this to follow a
repeatable series of point values, you need the series of window-start
positions to be repeatable, too.

IOW, if you start with point P1 and window-start W1, and do a C-v
followed by M-v, then setting point at the same pixel distance from
the left-top window edge will get you back to P1 iff the window-start
gets back at W1.

>  > But this is impossible to ensure with the way we compute
>  > window-start, because the move_it family of functions used for that
>  > can only move forward; therefore moving back is necessarily
>  > implemented differently, and the results differ when variable-size
>  > fonts are present.
>  >
>  > IOW, this is a limitation of the current design of the
>  > window-scrolling functions that can only be lifted by redesigning.
> 
> I'm completely happy with the following solution: Whenever, after a
> sequence of scrolling commands, the original position (that is the
> position before the sequence started) reappears in a window, move to
> that position and leave the window start position alone.  See also
> 
> http://lists.gnu.org/archive/html/emacs-devel/2008-02/msg01892.html

Fine by me.  However, the OP asked if there's an existing feature in
Emacs that can satisfy this need.  After looking into this, my
response was that no, there's no such a feature.  (The fact that
setting scroll-preserve-screen-position is documented in the manual as
providing this feature is, I suspect, a remnant from the old display
engine that only supported fixed fonts.)

The solution you propose, and another one implemented in
scroll-in-place.el, is OK, and indeed this is better done in Lisp than
in C.





reply via email to

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