unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: scroll-preserve-screen-position BROKEN when header line displayed
Date: Sun, 31 Oct 2004 04:42:21 -0500	[thread overview]
Message-ID: <E1COCE9-0002Na-Qg@fencepost.gnu.org> (raw)
In-Reply-To: <1098916074.5728.8.camel@coltrane.laudi.ka> (message from Jens Lautenbacher on Thu, 28 Oct 2004 00:27:54 +0200)

This fixes it for me.  Do you get good results?

*** window.c	16 Oct 2004 01:47:10 -0400	1.480
--- window.c	31 Oct 2004 03:45:20 -0500	
***************
*** 4625,4641 ****
        w->force_start = Qt;
      }
  
    it.current_y = it.vpos = 0;
  
!   /* Preserve the screen position if we must.  */
    if (preserve_y >= 0)
      {
        move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y);
        SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
      }
    else
      {
!       /* Move PT out of scroll margins.  */
        this_scroll_margin = max (0, scroll_margin);
        this_scroll_margin = min (this_scroll_margin, XFASTINT (w->total_lines) / 4);
        this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
--- 4625,4649 ----
        w->force_start = Qt;
      }
  
+   /* The rest of this function uses current_y in a nonstandard way,
+      not including the height of the header line if any.  */
    it.current_y = it.vpos = 0;
  
!   /* Preserve the screen position if we should.  */
    if (preserve_y >= 0)
      {
+       /* If we have a header line, take account of it.  */
+       if (WINDOW_WANTS_HEADER_LINE_P (w))
+ 	preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w);
+ 
        move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y);
        SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
      }
    else
      {
!       /* Move PT out of scroll margins.
! 	 This code wants current_y to be zero at the window start position
! 	 even if there is a header line.  */
        this_scroll_margin = max (0, scroll_margin);
        this_scroll_margin = min (this_scroll_margin, XFASTINT (w->total_lines) / 4);
        this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);

  reply	other threads:[~2004-10-31  9:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-27 22:27 scroll-preserve-screen-position BROKEN when header line displayed Jens Lautenbacher
2004-10-31  9:42 ` Richard Stallman [this message]
2004-11-01  0:33   ` Jens Lautenbacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1COCE9-0002Na-Qg@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).