[Top][All Lists]

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

Re: Problems with non-zero scroll-margin

From: Ralf Angeli
Subject: Re: Problems with non-zero scroll-margin
Date: Tue, 05 Jul 2005 10:25:43 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

* Richard M. Stallman (2005-07-05) writes:

>     Besides GDB another easy to use testcase is ielm.  Type `M-x ielm RET'
>     and press <RET> until the prompt reaches the bottom of the window.
>     When this happens point will be placed in the middle of the screen.
> This problem does not happen for me after my last change.

Neither do I see it.

> However, I
> think that is be a bug.  If (recenter -1) puts point inside the scroll
> margins, the scroll margin code must be broken.
> I will fix it to put point just within the specified margin.

Okay.  If this doesn't prevent the last line from jumping up and down
like one can observe it now in the ielm case, the following change on
the Lisp level might be an idea as well:

--- comint.el   04 Jul 2005 10:21:17 +0200      1.325
+++ comint.el   05 Jul 2005 09:54:31 +0200      
@@ -1818,7 +1818,7 @@
                              (= (point) (point-max)))
                           (goto-char (point-max))
-                          (recenter -1)))
+                          (recenter (- -1 scroll-margin))))
                     (select-window selected)))))
             nil t))
       (set-buffer current))))
@@ -1852,7 +1852,7 @@
   "Put the end of the buffer at the bottom of the window."
   (goto-char (point-max))
-  (recenter -1))
+  (recenter (- -1 scroll-margin)))
 (defun comint-get-old-input-default ()
   "Default for `comint-get-old-input'.

> I could do this for move-to-window-line also, and I wrote the code to
> do that, but it might be incorrect to install it.  move-to-window-line
> is supposed to move point to the text now on a certain line, and if it
> moves point to some other place, that feels like a bug to me.  So the
> programs that are calling move-to-window-line probably should take
> account of scroll-margin's value in some way.

In case of Gnus I could mostly fix article scrolling with the
following changes:

--- gnus-art.el 02 Jul 2005 15:02:32 +0200      1.82
+++ gnus-art.el 05 Jul 2005 10:22:51 +0200      
@@ -5160,7 +5160,7 @@
 If end of article, return non-nil.  Otherwise return nil.
 Argument LINES specifies lines to be scrolled up."
   (interactive "p")
-  (move-to-window-line -1)
+  (move-to-window-line (max (- -1 scroll-margin) (- -1 (window-body-height))))
   (if (save-excursion
        (and (pos-visible-in-window-p)  ;Not continuation line.
@@ -5189,13 +5189,13 @@
        ;; Long lines may cause an end-of-buffer error.
        (goto-char (point-max)))))
-  (move-to-window-line 0))
+  (move-to-window-line (min scroll-margin (window-body-height))))
 (defun gnus-article-prev-page (&optional lines)
   "Show previous page of current article.
 Argument LINES specifies lines to be scrolled down."
   (interactive "p")
-  (move-to-window-line 0)
+  (move-to-window-line (min scroll-margin (window-body-height)))
   (if (and gnus-page-broken
           (not (save-restriction (widen) (bobp)))) ;Real beginning-of-buffer?
@@ -5209,7 +5209,7 @@
              (scroll-down lines)
             (goto-char (point-min))))
-       (move-to-window-line 0)))))
+       (move-to-window-line (min scroll-margin (window-body-height)))))))
 (defun gnus-article-only-boring-p ()
   "Decide whether there is only boring text remaining in the article.

Unfortunately, although the arguments supplied to
`move-to-window-line' are limited to the value of
`(window-body-height)', scrolling still fails in case the value of
`scroll-margin' is greater than the window body height.


reply via email to

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