unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* redisplay code + non-plain-text-only buffers + scroll-conservatively [Re: Bug: ruler-mode breaks scroll-conservatively (HEAD)]
       [not found] ` <E18Sgcd-00078i-00@fencepost.gnu.org>
@ 2002-12-30  0:52   ` quarl
  2002-12-31  5:48     ` Richard Stallman
  0 siblings, 1 reply; 5+ messages in thread
From: quarl @ 2002-12-30  0:52 UTC (permalink / raw)
  Cc: Emacs Developement List

>>>>> "rms" == Richard Stallman <rms@gnu.org> writes:

    rms> Thanks for reporting it.  Does this give good results?

Yes, but only with `ruler-mode' in a text-only (no fonts) buffer.

Scrolling `customize' buffers (with font-locked headings, with or without
ruler-mode) is even more broken now:

"emacs -q"   "(setq scroll-conservatively 9999) (customize)" 
    behaves the same as before - recenters the window when it should scroll
    one line

"emacs -q"   "(highline-mode) (setq scroll-conservatively 9999) (customize)"
    HANGS emacs! sometimes C-g can unhang it, usually not.
    Highline is from http://www.cpqd.com.br/~vinicius/emacs/

Maybe a good test case would be even more complicated buffers (for example w3
or the startup screen)

-- 
Karl Chen / quarl@quarl.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: redisplay code + non-plain-text-only buffers + scroll-conservatively [Re: Bug: ruler-mode breaks scroll-conservatively (HEAD)]
  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
  2002-12-31  9:52       ` Juanma Barranquero
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Stallman @ 2002-12-31  5:48 UTC (permalink / raw)
  Cc: emacs-devel

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:

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: redisplay code + non-plain-text-only buffers + scroll-conservatively [Re: Bug: ruler-mode breaks scroll-conservatively (HEAD)]
  2002-12-31  5:48     ` Richard Stallman
@ 2002-12-31  9:52       ` Juanma Barranquero
  2002-12-31 11:35         ` Karl Chen
  2003-01-02 18:39         ` Richard Stallman
  0 siblings, 2 replies; 5+ messages in thread
From: Juanma Barranquero @ 2002-12-31  9:52 UTC (permalink / raw)
  Cc: quarl

On Tue, 31 Dec 2002 00:48:40 -0500, Richard Stallman <rms@gnu.org> wrote:

> Does this fix it?
> 
> *** xdisp.c.~1.797.~	Sun Dec 22 16:13:49 2002
> --- xdisp.c	Tue Dec 31 00:26:36 2002

With this patch, scroll-conservatively works.

Still, there's a difference between scrolling down a buffer with
partially visible lines and without. With full lines, if you maintain
<down> pressed, the scroll is totally smooth. With a partially-visible
last line, the scroll "jumps" slightly every now and then (at more-or-less
equally distributed intervals, apparently).

                                                           /L/e/k/t/u

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: redisplay code + non-plain-text-only buffers + scroll-conservatively [Re: Bug: ruler-mode breaks scroll-conservatively (HEAD)]
  2002-12-31  9:52       ` Juanma Barranquero
@ 2002-12-31 11:35         ` Karl Chen
  2003-01-02 18:39         ` Richard Stallman
  1 sibling, 0 replies; 5+ messages in thread
From: Karl Chen @ 2002-12-31 11:35 UTC (permalink / raw)
  Cc: emacs-devel

>>>>> "Juanma" == Juanma Barranquero <lektu@terra.es> writes:

    Juanma> On Tue, 31 Dec 2002 00:48:40 -0500, Richard Stallman <rms@gnu.org> wrote:
    >> Does this fix it?
    >> 
    >> *** xdisp.c.~1.797.~	Sun Dec 22 16:13:49 2002
    >> --- xdisp.c	Tue Dec 31 00:26:36 2002

    Juanma> With this patch, scroll-conservatively works.

    Juanma> Still, there's a difference between scrolling down a buffer with
    Juanma> partially visible lines and without. With full lines, if you maintain
    Juanma> <down> pressed, the scroll is totally smooth. With a partially-visible
    Juanma> last line, the scroll "jumps" slightly every now and then (at more-or-less
    Juanma> equally distributed intervals, apparently).

Yes, I get the same results.

BTW, you can also get this behavior if you (setq scroll-step 1
scroll-conservatively 0) and hold down <down> on a ruler-less regular text
buffer on a slow remote X connection. Once in a while it'll jump a little to
"catch up" to point.

Anyway at least this patch works 95% of the time and never hangs
(is 95% good enough? http://www.jwz.org/doc/worse-is-better.html)

-- 
Karl Chen / quarl@quarl.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: redisplay code + non-plain-text-only buffers + scroll-conservatively [Re: Bug: ruler-mode breaks scroll-conservatively (HEAD)]
  2002-12-31  9:52       ` Juanma Barranquero
  2002-12-31 11:35         ` Karl Chen
@ 2003-01-02 18:39         ` Richard Stallman
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2003-01-02 18:39 UTC (permalink / raw)
  Cc: quarl

    Still, there's a difference between scrolling down a buffer with
    partially visible lines and without. With full lines, if you maintain
    <down> pressed, the scroll is totally smooth. With a partially-visible
    last line, the scroll "jumps" slightly every now and then (at more-or-less
    equally distributed intervals, apparently).

That is going to be quite hard to debug, since it can't be reproduced
and happens only occasionally in a series of many similar actions.
The only technique I can think of is to insert debugging log output
code in many places, and record all the output; then, when it fails,
go back and find the log output for that failure and see how it
differs from the usual log output.

I can't afford to do this myself--I am overloaded.  Would someone else
like to do it?

The place to start putting in the debugging printouts is in various places
in the function try_scrolling.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-01-02 18:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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
2002-12-31  9:52       ` Juanma Barranquero
2002-12-31 11:35         ` Karl Chen
2003-01-02 18:39         ` Richard Stallman

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).