bug-gnu-emacs
[Top][All Lists]
Advanced

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

Patch for the "scroll-conservatively" functionality


From: Steven Elliott
Subject: Patch for the "scroll-conservatively" functionality
Date: Mon, 26 Feb 2001 00:14:15 -0600

I've attached a patch that fixes a problem with scrolling that can be
seen when lines are slightly longer than the window width (80
characters) and the "scroll-conervatively" variable is set to a non-zero
value.  Ex:
    (setq scroll-conservatively 10)
The problem occurs when scrolling past lines that are slightly longer
than the window width as the window is recentered by the "recenter:"
logic in redisplay_window().

The problem can be seen in the following files
    http://home.austin.rr.com/selliott4/emacs/x_lines_inc
    http://home.austin.rr.com/selliott4/emacs/x_lines_dec
by starting at the beginning of the line at the top or bottom of either
of the above files and then scrolling down or up via C-n and C-p until a
line that is slightly longer than the window width is crossed at which
point the window is recentered.

The patch was generated from emacs-20.7.  Let me know if you need any
additional information.

-- 
Steven L. Elliott (address@hidden)
*** src/xdisp.c.orig    Mon Jan 29 07:51:43 2001
--- src/xdisp.c Thu Feb 22 21:57:41 2001
*************** redisplay_window (window, just_this_one,
*** 2272,2282 ****
        {
          struct position pos;
          pos = *compute_motion (scroll_margin_pos, 0, 0, 0,
!                                PT, XFASTINT (w->height), 0,
!                                XFASTINT (w->width), XFASTINT (w->hscroll),
                                 pos_tab_offset (w, scroll_margin_pos,
!                                                scroll_margin_bytepos),
!                                w);
          if (pos.vpos >= scroll_max)
            goto scroll_fail_1;
  
--- 2272,2281 ----
        {
          struct position pos;
          pos = *compute_motion (scroll_margin_pos, 0, 0, 0,
!                                PT, height, 0, width,
!                                XFASTINT (w->hscroll),
                                 pos_tab_offset (w, scroll_margin_pos,
!                                                scroll_margin_bytepos), w);
          if (pos.vpos >= scroll_max)
            goto scroll_fail_1;
  
*************** redisplay_window (window, just_this_one,
*** 2315,2325 ****
        if (PT < scroll_margin_pos)
        {
          struct position pos;
!         pos = *compute_motion (PT, 0, 0, 0,
!                                scroll_margin_pos, XFASTINT (w->height), 0,
!                                XFASTINT (w->width), XFASTINT (w->hscroll),
!                                pos_tab_offset (w, PT, PT_BYTE),
!                                w);
          if (pos.vpos > scroll_max)
            goto scroll_fail_1;
  
--- 2314,2325 ----
        if (PT < scroll_margin_pos)
        {
          struct position pos;
!         int fromhpos;
!         fromhpos = pos_tab_offset (w, PT, PT_BYTE);
!         pos = *compute_motion (PT, 0, fromhpos, 0,
!                                scroll_margin_pos, height, 0,
!                                width, XFASTINT (w->hscroll),
!                                fromhpos, w);
          if (pos.vpos > scroll_max)
            goto scroll_fail_1;
  
2001-02-24  Steven L. Elliott  <address@hidden>

        * xdisp.c: (redisplay_window): Changed the "height", "width" and
        "fromhpos" passed to compute_motion() to what the comments in
        compute_motion() specify in order to make scrolling smoother when
        "scroll-conservatively" is set.

reply via email to

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