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

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

Re: 21.1: mh-e folder mode displayed incorrectly


From: Gerd Moellmann
Subject: Re: 21.1: mh-e folder mode displayed incorrectly
Date: 25 Oct 2001 12:05:40 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.50

Peter S Galbraith <GalbraithP@dfo-mpo.gc.ca> writes:

>  In a 3-line window (4 lines when counting the status line),
>  running (recenter '(list 4)) puts the cursor on the second line
>  (the middle of the 3 lines) when executed in emacs20.  This is
>  the intended behaviour in the mh-folder window.
> 
>  The same command done in emacs21 does not consistently place the
>  cursor on the second line.  In my tests, it either goes to the
>  first line or the last line, depending on whether the 3-line
>  window is on top or bottom.  Note that it works correctly in a
>  non-window emacs so the bug is in the
>   if (FRAME_WINDOW_P (XFRAME (w->frame)))
>  part of window.c's DEFUN("recenter").
> 
> In summary, I think it's an emacs21 bug in (recenter) and not an
> mh-e bug.

Could plaase check with this patch, Peter?

*** xdisp.c     2001/10/24 15:15:18     1.693
--- xdisp.c     2001/10/25 10:04:11
***************
*** 5311,5318 ****
       struct it *it;
       int dy;
  {
!   int nlines, h, line_height;
!   struct it it2;
    int start_pos = IT_CHARPOS (*it);
    
    xassert (dy >= 0);
--- 5311,5318 ----
       struct it *it;
       int dy;
  {
!   int nlines, h;
!   struct it it2, it3;
    int start_pos = IT_CHARPOS (*it);
    
    xassert (dy >= 0);
***************
*** 5342,5348 ****
    move_it_to (&it2, start_pos, -1, -1, it2.vpos + 1,
              MOVE_TO_POS | MOVE_TO_VPOS);
    xassert (IT_CHARPOS (*it) >= BEGV);
!   line_height = it2.max_ascent + it2.max_descent;
    
    move_it_to (&it2, start_pos, -1, -1, -1, MOVE_TO_POS);
    xassert (IT_CHARPOS (*it) >= BEGV);
--- 5342,5348 ----
    move_it_to (&it2, start_pos, -1, -1, it2.vpos + 1,
              MOVE_TO_POS | MOVE_TO_VPOS);
    xassert (IT_CHARPOS (*it) >= BEGV);
!   it3 = it2;
    
    move_it_to (&it2, start_pos, -1, -1, -1, MOVE_TO_POS);
    xassert (IT_CHARPOS (*it) >= BEGV);
***************
*** 5366,5375 ****
        /* The y-position we try to reach.  Note that h has been
           subtracted in front of the if-statement.  */
        int target_y = it->current_y + h - dy;
! 
        /* If we did not reach target_y, try to move further backward if
         we can.  If we moved too far backward, try to move forward.  */
        if (target_y < it->current_y
          && IT_CHARPOS (*it) > BEGV)
        {
          move_it_vertically (it, target_y - it->current_y);
--- 5366,5383 ----
        /* The y-position we try to reach.  Note that h has been
           subtracted in front of the if-statement.  */
        int target_y = it->current_y + h - dy;
!       int y0 = it3.current_y;
!       int y1 = line_bottom_y (&it3);
!       int line_height = y1 - y0;
!       
        /* If we did not reach target_y, try to move further backward if
         we can.  If we moved too far backward, try to move forward.  */
        if (target_y < it->current_y
+         /* This is heuristic.  In a window that's 3 lines high, with
+            a line height of 13 pixels each, recentering with point
+            on the bottom line will try to move -39/2 = 19 pixels
+            backward.  Try to avoid moving into the first line.  */
+         && it->current_y - target_y > line_height / 2
          && IT_CHARPOS (*it) > BEGV)
        {
          move_it_vertically (it, target_y - it->current_y);



reply via email to

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