From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 51590@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 [thread overview]
Message-ID: <86pmrf3l9m.fsf_-_@mail.linkov.net> (raw)
In-Reply-To: <83h7ctgk93.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 03 Nov 2021 20:35:36 +0200")
[-- Attachment #1: Type: text/plain, Size: 971 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: follow-line-height.patch --]
[-- Type: text/x-diff, Size: 963 bytes --]
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)))
next prev parent reply other threads:[~2021-11-04 17:29 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-03 18:24 bug#51590: Tab-line breaks windows of follow-mode Juri Linkov
2021-11-03 18:35 ` Eli Zaretskii
2021-11-04 17:29 ` Juri Linkov [this message]
2021-11-04 18:46 ` bug#51590: follow-mode is broken with header-line and tab-line Eli Zaretskii
2021-11-04 19:06 ` Alan Mackenzie
2021-11-05 21:45 ` Alan Mackenzie
2021-11-06 7:00 ` Eli Zaretskii
2021-11-06 11:50 ` Alan Mackenzie
2021-11-06 12:12 ` Eli Zaretskii
2021-11-06 18:31 ` martin rudalics
2021-11-06 18:40 ` Eli Zaretskii
2021-11-08 15:36 ` martin rudalics
2021-11-08 17:32 ` martin rudalics
2021-11-08 18:47 ` Eli Zaretskii
2021-11-09 10:14 ` martin rudalics
2021-11-06 18:44 ` martin rudalics
2021-11-08 17:59 ` Alan Mackenzie
2021-11-08 18:23 ` Eli Zaretskii
2021-11-09 10:12 ` martin rudalics
2021-11-09 10:10 ` martin rudalics
2021-11-04 18:52 ` martin rudalics
2021-11-07 12:48 ` Alan Mackenzie
2021-11-07 13:14 ` Eli Zaretskii
2021-11-07 14:28 ` Alan Mackenzie
2021-11-07 17:46 ` Juri Linkov
2021-11-07 19:44 ` Alan Mackenzie
2021-11-07 19:56 ` Juri Linkov
2021-11-08 7:13 ` Alan Mackenzie
2021-11-05 7:42 ` Stefan Kangas
2021-11-05 8:55 ` Juri Linkov
2021-11-05 10:15 ` Stefan Kangas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86pmrf3l9m.fsf_-_@mail.linkov.net \
--to=juri@linkov.net \
--cc=51590@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).