From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel 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 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <15867.5338.229659.360718@quack.quarl.org> <15887.39112.118522.278925@hkn.eecs.berkeley.edu> Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1041313866 7309 80.91.224.249 (31 Dec 2002 05:51:06 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 31 Dec 2002 05:51:06 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18TFIs-0001tj-00 for ; Tue, 31 Dec 2002 06:51:02 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18TFJs-0006E8-00 for ; Tue, 31 Dec 2002 06:52:04 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18TFJ3-0001ar-02 for emacs-devel@quimby.gnus.org; Tue, 31 Dec 2002 00:51:13 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18TFIc-0001aZ-00 for emacs-devel@gnu.org; Tue, 31 Dec 2002 00:50:46 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18TFIX-0001We-00 for emacs-devel@gnu.org; Tue, 31 Dec 2002 00:50:42 -0500 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18TFGb-0008Tt-00 for emacs-devel@gnu.org; Tue, 31 Dec 2002 00:48:41 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.10) id 18TFGa-0005m5-00; Tue, 31 Dec 2002 00:48:40 -0500 Original-To: quarl@quarl.org In-reply-to: <15887.39112.118522.278925@hkn.eecs.berkeley.edu> (quarl@hkn.eecs.berkeley.edu) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:10377 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:10377 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: