emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/window.c


From: Kim F . Storm
Subject: [Emacs-diffs] Changes to emacs/src/window.c
Date: Fri, 12 Nov 2004 09:36:13 -0500

Index: emacs/src/window.c
diff -c emacs/src/window.c:1.483 emacs/src/window.c:1.484
*** emacs/src/window.c:1.483    Tue Nov  9 11:16:32 2004
--- emacs/src/window.c  Fri Nov 12 14:26:53 2004
***************
*** 4506,4512 ****
         results for variable height lines.  */
        init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
        it.current_y = it.last_visible_y;
!       move_it_vertically (&it, - window_box_height (w) / 2);
  
        /* The function move_iterator_vertically may move over more than
         the specified y-distance.  If it->w is small, e.g. a
--- 4506,4512 ----
         results for variable height lines.  */
        init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
        it.current_y = it.last_visible_y;
!       move_it_vertically_backward (&it, window_box_height (w) / 2);
  
        /* The function move_iterator_vertically may move over more than
         the specified y-distance.  If it->w is small, e.g. a
***************
*** 4516,4522 ****
        if (it.current_y <= 0)
        {
          init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
!         move_it_vertically (&it, 0);
          it.current_y = 0;
        }
  
--- 4516,4522 ----
        if (it.current_y <= 0)
        {
          init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
!         move_it_vertically_backward (&it, 0);
          it.current_y = 0;
        }
  
***************
*** 5185,5191 ****
  
          SET_TEXT_POS (pt, PT, PT_BYTE);
          start_display (&it, w, pt);
!         move_it_vertically (&it, - window_box_height (w) / 2);
          charpos = IT_CHARPOS (it);
          bytepos = IT_BYTEPOS (it);
        }
--- 5185,5191 ----
  
          SET_TEXT_POS (pt, PT, PT_BYTE);
          start_display (&it, w, pt);
!         move_it_vertically_backward (&it, window_box_height (w) / 2);
          charpos = IT_CHARPOS (it);
          bytepos = IT_BYTEPOS (it);
        }
***************
*** 5193,5221 ****
        {
          struct it it;
          struct text_pos pt;
!         int y0, y1, h, nlines;
  
          SET_TEXT_POS (pt, PT, PT_BYTE);
          start_display (&it, w, pt);
!         y0 = it.current_y;
  
          /* The amount of pixels we have to move back is the window
             height minus what's displayed in the line containing PT,
             and the lines below.  */
!         nlines = - XINT (arg) - 1;
          move_it_by_lines (&it, nlines, 1);
  
!         y1 = line_bottom_y (&it);
  
          /* If we can't move down NLINES lines because we hit
             the end of the buffer, count in some empty lines.  */
          if (it.vpos < nlines)
!           y1 += (nlines - it.vpos) * FRAME_LINE_HEIGHT (it.f);
! 
!         h = window_box_height (w) - (y1 - y0);
  
          start_display (&it, w, pt);
!         move_it_vertically (&it, - h);
          charpos = IT_CHARPOS (it);
          bytepos = IT_BYTEPOS (it);
        }
--- 5193,5254 ----
        {
          struct it it;
          struct text_pos pt;
!         int nlines = - XINT (arg);
!         int extra_line_spacing;
!         int h = window_box_height (w);
  
          SET_TEXT_POS (pt, PT, PT_BYTE);
          start_display (&it, w, pt);
! 
!         /* Be sure we have the exact height of the full line containing PT.  
*/
!         move_it_by_lines (&it, 0, 1);
  
          /* The amount of pixels we have to move back is the window
             height minus what's displayed in the line containing PT,
             and the lines below.  */
!         it.current_y = 0;
!         it.vpos = 0;
          move_it_by_lines (&it, nlines, 1);
  
!         if (it.vpos == nlines)
!           h -= it.current_y;
!         else
!           {
!             /* Last line has no newline */
!             h -= line_bottom_y (&it);
!             it.vpos++;
!           }
! 
!         /* Don't reserve space for extra line spacing of last line.  */
!         extra_line_spacing = it.max_extra_line_spacing;
  
          /* If we can't move down NLINES lines because we hit
             the end of the buffer, count in some empty lines.  */
          if (it.vpos < nlines)
!           {
!             nlines -= it.vpos;
!             extra_line_spacing = it.extra_line_spacing;
!             h -= nlines * (FRAME_LINE_HEIGHT (it.f) + extra_line_spacing);
!           }
!         if (h <= 0)
!           return Qnil;
  
+         /* Now find the new top line (starting position) of the window.  */
          start_display (&it, w, pt);
!         it.current_y = 0;
!         move_it_vertically_backward (&it, h);
! 
!         /* If extra line spacing is present, we may move too far
!            back.  This causes the last line to be only partially
!            visible (which triggers redisplay to recenter that line
!            in the middle), so move forward.
!            But ignore extra line spacing on last line, as it is not
!            considered to be part of the visible height of the line.
!         */
!         h += extra_line_spacing;
!         while (-it.current_y > h)
!           move_it_by_lines (&it, 1, 1);
! 
          charpos = IT_CHARPOS (it);
          bytepos = IT_BYTEPOS (it);
        }




reply via email to

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