emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/src/xdisp.c
Date: Sun, 07 Jul 2002 06:51:15 -0400

Index: emacs/src/xdisp.c
diff -c emacs/src/xdisp.c:1.760 emacs/src/xdisp.c:1.761
*** emacs/src/xdisp.c:1.760     Fri Jul  5 15:59:54 2002
--- emacs/src/xdisp.c   Sun Jul  7 06:50:49 2002
***************
*** 9470,9479 ****
  }
  
  
! /* Modify the desired matrix of window W and W->vscroll so that the
!    line containing the cursor is fully visible.
!    A value of 1 means there is nothing to be done or we did it.
!    A value of 0 causes redisplay.  */
  
  static int
  make_cursor_line_fully_visible (w)
--- 9470,9481 ----
  }
  
  
! /* Make sure the line containing the cursor is fully visible.
!    A value of 1 means there is nothing to be done.
!    (Either the line is fully visible, or it cannot be made so,
!    or we cannot tell.)
!    A value of 0 means the caller should do scrolling
!    as if point had gone off the screen.  */
  
  static int
  make_cursor_line_fully_visible (w)
***************
*** 9501,9506 ****
--- 9503,9515 ----
    if (row->height >= window_height)
      return 1;
  
+   return 0;
+ 
+ #if 0
+   /* This code used to try to scroll the window just enough to make
+      the line visible.  It returned 0 to say that the caller should
+      allocate larger glyph matrices.  */
+ 
    if (MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row))
      {
        int dy = row->height - row->visible_height;
***************
*** 9532,9537 ****
--- 9541,9547 ----
      }
  
    return 1;
+ #endif /* 0 */
  }
  
  
***************
*** 9628,9633 ****
--- 9638,9644 ----
      {
        int y0;
  
+     too_near_end:
        /* Point is in the scroll margin at the bottom of the window, or
         below.  Compute a new window start that makes point visible.  */
  
***************
*** 9748,9760 ****
          || BEG_UNCHANGED < CHARPOS (startp))
        w->base_line_number = Qnil;
  
!       /* If cursor ends up on a partially visible line, shift display
!        lines up or down.  If that fails because we need larger
!        matrices, give up.  */
!       if (!make_cursor_line_fully_visible (w))
!       rc = SCROLLING_NEED_LARGER_MATRICES;
!       else
!       rc = SCROLLING_SUCCESS;
      }
  
    return rc;
--- 9759,9769 ----
          || BEG_UNCHANGED < CHARPOS (startp))
        w->base_line_number = Qnil;
  
!       /* If cursor ends up on a partially visible line,
!        treat that as being off the bottom of the screen.  */
!       if (! make_cursor_line_fully_visible (w))
!       goto too_near_end;
!       rc = SCROLLING_SUCCESS;
      }
  
    return rc;
***************
*** 10043,10049 ****
                  set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
                  try_window (window, startp);
                  if (!make_cursor_line_fully_visible (w))
!                   rc = CURSOR_MOVEMENT_NEED_LARGER_MATRICES;
                  else
                    rc = CURSOR_MOVEMENT_SUCCESS;
                }
--- 10052,10058 ----
                  set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
                  try_window (window, startp);
                  if (!make_cursor_line_fully_visible (w))
!                   rc = CURSOR_MOVEMENT_MUST_SCROLL;
                  else
                    rc = CURSOR_MOVEMENT_SUCCESS;
                }
***************
*** 10083,10088 ****
--- 10092,10098 ----
    int temp_scroll_step = 0;
    int count = BINDING_STACK_SIZE ();
    int rc;
+   int centering_position;
  
    SET_TEXT_POS (lpoint, PT, PT_BYTE);
    opoint = lpoint;
***************
*** 10333,10339 ****
        }
  
        if (!make_cursor_line_fully_visible (w))
!       goto need_larger_matrices;
  #if GLYPH_DEBUG
        debug_method_add (w, "forced window start");
  #endif
--- 10343,10349 ----
        }
  
        if (!make_cursor_line_fully_visible (w))
!       goto try_to_scroll;
  #if GLYPH_DEBUG
        debug_method_add (w, "forced window start");
  #endif
***************
*** 10429,10435 ****
            w->base_line_number = Qnil;
  
          if (!make_cursor_line_fully_visible (w))
!           goto need_larger_matrices;
          goto done;
        }
        else
--- 10439,10446 ----
            w->base_line_number = Qnil;
  
          if (!make_cursor_line_fully_visible (w))
!           /* Drop through and scroll.  */
!           ;
          goto done;
        }
        else
***************
*** 10483,10488 ****
--- 10494,10503 ----
    /* Finally, just choose place to start which centers point */
  
   recenter:
+   centering_position = window_box_height (w) / 2;
+ 
+  point_at_top:
+   /* Jump here with centering_position already set to 0.  */
  
  #if GLYPH_DEBUG
    debug_method_add (w, "recenter");
***************
*** 10498,10504 ****
    /* Move backward half the height of the window.  */
    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);
    xassert (IT_CHARPOS (it) >= BEGV);
  
    /* The function move_it_vertically_backward may move over more
--- 10513,10519 ----
    /* Move backward half the height of the window.  */
    init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
    it.current_y = it.last_visible_y;
!   move_it_vertically_backward (&it, centering_position);
    xassert (IT_CHARPOS (it) >= BEGV);
  
    /* The function move_it_vertically_backward may move over more
***************
*** 10580,10586 ****
      }
  
    if (!make_cursor_line_fully_visible (w))
!     goto need_larger_matrices;
  
   done:
  
--- 10595,10607 ----
      }
  
    if (!make_cursor_line_fully_visible (w))
!     {
!       /* If centering point failed to make the whole line visible,
!        put point at the top instead.  That has to make the whole line
!        visible, if it can be done.  */
!       centering_position = 0;
!       goto point_at_top;
!     }
  
   done:
  



reply via email to

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