emacs-devel
[Top][All Lists]
Advanced

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

Re: scroll-preserve-screen-position BROKEN when header line displayed


From: Richard Stallman
Subject: Re: scroll-preserve-screen-position BROKEN when header line displayed
Date: Sun, 31 Oct 2004 04:42:21 -0500

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 via email to

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