emacs-devel
[Top][All Lists]
Advanced

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

Re: redisplay code + non-plain-text-only buffers + scroll-conservatively


From: Richard Stallman
Subject: Re: redisplay code + non-plain-text-only buffers + scroll-conservatively [Re: Bug: ruler-mode breaks scroll-conservatively (HEAD)]
Date: Tue, 31 Dec 2002 00:48:40 -0500

Does this fix it?

*** xdisp.c.~1.797.~    Sun Dec 22 16:13:49 2002
--- xdisp.c     Tue Dec 31 00:26:36 2002
***************
*** 770,776 ****
  static void extend_face_to_end_of_line P_ ((struct it *));
  static int append_space P_ ((struct it *, int));
  static int make_cursor_line_fully_visible P_ ((struct window *));
! static int try_scrolling P_ ((Lisp_Object, int, EMACS_INT, EMACS_INT, int));
  static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *));
  static int trailing_whitespace_p P_ ((int));
  static int message_log_check_duplicate P_ ((int, int, int, int));
--- 770,776 ----
  static void extend_face_to_end_of_line P_ ((struct it *));
  static int append_space P_ ((struct it *, int));
  static int make_cursor_line_fully_visible P_ ((struct window *));
! static int try_scrolling P_ ((Lisp_Object, int, EMACS_INT, EMACS_INT, int, 
int));
  static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *));
  static int trailing_whitespace_p P_ ((int));
  static int message_log_check_duplicate P_ ((int, int, int, int));
***************
*** 9609,9614 ****
--- 9609,9617 ----
     in redisplay_window to bring a partially visible line into view in
     the case that only the cursor has moved.
  
+    LAST_LINE_MISFIT should be nonzero if we're scrolling because the
+    last screen line's vertical height extends past the end of the screen.
+ 
     Value is
  
     1  if scrolling succeeded
***************
*** 9627,9637 ****
  
  static int
  try_scrolling (window, just_this_one_p, scroll_conservatively,
!              scroll_step, temp_scroll_step)
       Lisp_Object window;
       int just_this_one_p;
       EMACS_INT scroll_conservatively, scroll_step;
       int temp_scroll_step;
  {
    struct window *w = XWINDOW (window);
    struct frame *f = XFRAME (w->frame);
--- 9630,9641 ----
  
  static int
  try_scrolling (window, just_this_one_p, scroll_conservatively,
!              scroll_step, temp_scroll_step, last_line_misfit)
       Lisp_Object window;
       int just_this_one_p;
       EMACS_INT scroll_conservatively, scroll_step;
       int temp_scroll_step;
+      int last_line_misfit;
  {
    struct window *w = XWINDOW (window);
    struct frame *f = XFRAME (w->frame);
***************
*** 9647,9652 ****
--- 9651,9657 ----
    int amount_to_scroll = 0;
    Lisp_Object aggressive;
    int height;
+   int end_scroll_margin;
  
  #if GLYPH_DEBUG
    debug_method_add (w, "try_scrolling");
***************
*** 9683,9694 ****
       and move this_scroll_margin up to find the position of the scroll
       margin.  */
    window_end = Fwindow_end (window, Qt);
    CHARPOS (scroll_margin_pos) = XINT (window_end);
    BYTEPOS (scroll_margin_pos) = CHAR_TO_BYTE (CHARPOS (scroll_margin_pos));
!   if (this_scroll_margin)
      {
        start_display (&it, w, scroll_margin_pos);
!       move_it_vertically (&it, - this_scroll_margin);
        scroll_margin_pos = it.current.pos;
      }
  
--- 9688,9704 ----
       and move this_scroll_margin up to find the position of the scroll
       margin.  */
    window_end = Fwindow_end (window, Qt);
+ 
+  too_near_end:
+ 
    CHARPOS (scroll_margin_pos) = XINT (window_end);
    BYTEPOS (scroll_margin_pos) = CHAR_TO_BYTE (CHARPOS (scroll_margin_pos));
! 
!   end_scroll_margin = this_scroll_margin + !!last_line_misfit;
!   if (end_scroll_margin)
      {
        start_display (&it, w, scroll_margin_pos);
!       move_it_vertically (&it, - end_scroll_margin);
        scroll_margin_pos = it.current.pos;
      }
  
***************
*** 9696,9702 ****
      {
        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.  */
  
--- 9706,9711 ----
***************
*** 9722,9729 ****
  
        if (scroll_conservatively)
        amount_to_scroll
!         = max (max (dy, CANON_Y_UNIT (f)),
!                CANON_Y_UNIT (f) * max (scroll_step, temp_scroll_step));
        else if (scroll_step || temp_scroll_step)
        amount_to_scroll = scroll_max;
        else
--- 9731,9738 ----
  
        if (scroll_conservatively)
        amount_to_scroll
!         = min (max (dy, CANON_Y_UNIT (f)),
!                CANON_Y_UNIT (f) * scroll_conservatively);
        else if (scroll_step || temp_scroll_step)
        amount_to_scroll = scroll_max;
        else
***************
*** 9739,9744 ****
--- 9748,9755 ----
        return SCROLLING_FAILED;
  
        move_it_vertically (&it, amount_to_scroll);
+       if (CHARPOS (it.current.pos) == CHARPOS (startp))
+       move_it_by_lines (&it, 1, 1);
        startp = it.current.pos;
      }
    else
***************
*** 9822,9827 ****
--- 9833,9839 ----
        if (! make_cursor_line_fully_visible (w))
        {
          clear_glyph_matrix (w->desired_matrix);
+         last_line_misfit = 1;
          goto too_near_end;
        }
        rc = SCROLLING_SUCCESS;
***************
*** 10160,10165 ****
--- 10172,10178 ----
    int count = SPECPDL_INDEX ();
    int rc;
    int centering_position;
+   int last_line_misfit = 0;
  
    SET_TEXT_POS (lpoint, PT, PT_BYTE);
    opoint = lpoint;
***************
*** 10530,10536 ****
            w->base_line_number = Qnil;
  
          if (!make_cursor_line_fully_visible (w))
!           clear_glyph_matrix (w->desired_matrix);
            /* Drop through and scroll.  */
          else
            goto done;
--- 10543,10552 ----
            w->base_line_number = Qnil;
  
          if (!make_cursor_line_fully_visible (w))
!           {
!             clear_glyph_matrix (w->desired_matrix);
!             last_line_misfit = 1;
!           }
            /* Drop through and scroll.  */
          else
            goto done;
***************
*** 10566,10572 ****
        int rc = try_scrolling (window, just_this_one_p,
                              scroll_conservatively,
                              scroll_step,
!                             temp_scroll_step);
        switch (rc)
        {
        case SCROLLING_SUCCESS:
--- 10582,10588 ----
        int rc = try_scrolling (window, just_this_one_p,
                              scroll_conservatively,
                              scroll_step,
!                             temp_scroll_step, last_line_misfit);
        switch (rc)
        {
        case SCROLLING_SUCCESS:



reply via email to

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