unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
Cc: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <E18TFGa-0005m5-00@fencepost.gnu.org> (raw)
In-Reply-To: <15887.39112.118522.278925@hkn.eecs.berkeley.edu> (quarl@hkn.eecs.berkeley.edu)

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	other threads:[~2002-12-31  5:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <15867.5338.229659.360718@quack.quarl.org>
     [not found] ` <E18Sgcd-00078i-00@fencepost.gnu.org>
2002-12-30  0:52   ` redisplay code + non-plain-text-only buffers + scroll-conservatively [Re: Bug: ruler-mode breaks scroll-conservatively (HEAD)] quarl
2002-12-31  5:48     ` Richard Stallman [this message]
2002-12-31  9:52       ` Juanma Barranquero
2002-12-31 11:35         ` Karl Chen
2003-01-02 18:39         ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E18TFGa-0005m5-00@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).