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

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

bug#925: 23.0.60; follow-mode doesn't work in buffers with a header line


From: Phil Sung
Subject: bug#925: 23.0.60; follow-mode doesn't work in buffers with a header line
Date: Wed, 10 Sep 2008 12:53:54 -0400

martin rudalics writes:
 > Does it help when you set `scroll-conservatively' to 100?

No, it doesn't. When I do that, not only does the expected behavior
not happen, point moves back to the center of the first screen. This
didn't happen with the default value of scroll-conservatively.


Here's what I now think is going on:

When there's a header line, follow-mode miscomputes the beginning of
the second window-- if you try out the "steps to reproduce", you can
see that there's one line after the end of the first window which is
not visible in the second window. When you try to C-n to that line,
follow-mode can't display that line in either window, so something
weird happens.

I tried the (flawed) patch below, which decreases the effective
window-height when there's a header line. I'm not sure if this is the
right approach.

With this patch, point correctly moves from one window to the other,
and the two windows display consecutive lines, as expected. However,
sometimes when moving point between windows, the text will shift up or
down by a line. I don't know why that happens.

Thanks,
Phil


    follow.el (follow-scroll-down, follow-calc-win-end,
    follow-estimate-first-window-start): reduce effective window
    height when header line is present.

diff --git a/lisp/follow.el b/lisp/follow.el
index 508d0f5..766dfce 100644
--- a/lisp/follow.el
+++ b/lisp/follow.el
@@ -624,7 +624,7 @@ Works like `scroll-up' when not in Follow mode."
             (select-window win)
             (goto-char start)
             (vertical-motion (- (- (window-height win)
-                                   1
+                                   (if header-line-format 2 1)
                                    next-screen-context-lines)))
             (set-window-start win (point))
             (goto-char start)
@@ -887,7 +887,8 @@ Returns (end-pos end-of-buffer-p)"
       (prog1
          (save-excursion
            (goto-char (window-start))
-           (setq height (- (window-height) 1))
+           (setq height (- (window-height)
+                           (if header-line-format 2 1)))
            (setq buffer-end-p
                  (if (bolp)
                      (not (= height (vertical-motion height)))
@@ -1219,7 +1220,9 @@ position of the first window.  Otherwise it is a good 
guess."
       ;(setq exact (bolp))
       (vertical-motion 0 win)
       (while pred
-       (vertical-motion (- 1 (window-height (car pred))) (car pred))
+       (vertical-motion (- (if header-line-format 2 1)
+                           (window-height (car pred)))
+                        (car pred))
        (if (not (bolp))
          (setq exact nil))
        (setq pred (cdr pred)))






reply via email to

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