GNU bug report logs - #51590
follow-mode is broken with header-line and tab-line

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Wed, 3 Nov 2021 18:28:01 UTC

Severity: normal

Merged with 47498

Found in version 28.0.50

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51590 <at> debbugs.gnu.org
Subject: bug#51590: follow-mode is broken with header-line and tab-line
Date: Thu, 04 Nov 2021 19:29:28 +0200
[Message part 1 (text/plain, inline)]
retitle 51590 follow-mode is broken with header-line and tab-line
quit

>> The most low-level function of follow-mode is follow-calc-win-end.
>> When global-tab-line-mode is enabled, follow-calc-win-end
>> returns the same values as when global-tab-line-mode is disabled.
>
> Can you step through that function and see which part is misbehaving
> there?
>
>> I don't understand what more low-level function doesn't take
>> into account the height of the tab-line.  Maybe the problem is
>> in pos-visible-in-window-p?  Or maybe different values returned
>> by window-inside-pixel-edges and window-end?
>
> I don't know the answer, but I see that header-line-format is
> mentioned in one place in follow.el, and that is not a good sign...

Indeed, I tested with the header-line, and it has the same problem,
so retitled this bug report.

After trial and error, I arrived to the following patch that completely
fixes these problems.  However, I can't explain how it works.

[follow-line-height.patch (text/x-diff, inline)]
diff --git a/lisp/follow.el b/lisp/follow.el
index b64f4cb734..327c66d5ff 100644
--- a/lisp/follow.el
+++ b/lisp/follow.el
@@ -679,6 +679,7 @@ follow-scroll-down
 	     (goto-char start)
 	     (vertical-motion (- (- (window-height win)
 				    (if header-line-format 2 1)
+				    (if tab-line-format 2 1)
 				    next-screen-context-lines)))
 	     (set-window-start win (point))
 	     (goto-char start)
@@ -946,8 +947,10 @@ follow-calc-win-end
 used."
   (let* ((win (or win (selected-window)))
 	 (edges (window-inside-pixel-edges win))
-	 (ht (- (nth 3 edges) (nth 1 edges)))
-	 (last-line-pos (posn-point (posn-at-x-y 0 (1- ht) win))))
+	 (ht (+ (- (nth 3 edges) (nth 1 edges))
+		(window-header-line-height win)
+		(window-tab-line-height win)))
+	 (last-line-pos (posn-point (posn-at-x-y 0 (- ht 1) win))))
     (if (pos-visible-in-window-p last-line-pos win)
 	(let ((end (window-end win t)))
 	  (list end (pos-visible-in-window-p (point-max) win)))

This bug report was last modified 3 years and 199 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.