unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 51590@debbugs.gnu.org, juri@linkov.net
Subject: bug#51590: follow-mode is broken with header-line and tab-line
Date: Sat, 6 Nov 2021 11:50:48 +0000	[thread overview]
Message-ID: <YYZsGBOtJeDHyn1H@ACM> (raw)
In-Reply-To: <8335o9dazn.fsf@gnu.org>

Hello, Eli.

On Sat, Nov 06, 2021 at 09:00:44 +0200, Eli Zaretskii wrote:
> > Date: Fri, 5 Nov 2021 21:45:32 +0000
> > Cc: Juri Linkov <juri@linkov.net>, 51590@debbugs.gnu.org
> > From: Alan Mackenzie <acm@muc.de>

> > Yes.  There's a bug in posn-at-x-y, in that either the function or the
> > documentation is wrong.

> It isn't a bug, it is a deliberately implemented behavior.  See also
> bug#15783.

> > The doc says, rather unhelpfully, "By default, X and Y are relative to
> > [the] text area of the selected window.".  What does "[the] text area"
> > mean?

> In the ELisp manual, type "i text area of a window RET" and read there.

> I've now made changes there to make clear that the header-line and the
> tab-line _are_ included in the text area.

I'm just confused at the moment, after having spent several hours trying
to sort things out in my head.

I think "window body" and "window text area" mean the same thing, but
I'm not sure.

The picture in elisp page "Basic Windows" seems to show "window body
height" as NOT including the header line or tab line.  That picture
seems to show the header line as being ABOVE the text area, not part of
it.

The current implementation of posn-at-x-y includes the header line in
its Y coordinate, BUT NOT THE TAB LINE.  I think this is a bug.

window-inside-pixel-edges, aka (window-edges &optional WINDOW BODY
ABSOLUTE PIXELWISE) with BODY and PIXELWISE non-nil, returns (according
to the elisp page) "the edges of WINDOW's body".  This "body" DOES NOT
include the tab line or the header line.  When I run the function on an
info page with tab-bar-mode enabled in my tty I get:

    (0 2 240 65)
       ^

..  This would appear to contradict the above notion of "body" as
including the header and tab lines.

It seems to me that we really need two distinct terms here, one for the
text area of the buffer including the header and tab lines, and another
for the "pure" text area without those lines.  Maybe something like
"extended body" vs. "text area", or something like that.

> > In posn-at-x-y, "the text area" _INCLUDES_ THE HEADER LINE.

> Yes.  As it should.

OK.

> > It would appear this behaviour of posn-at-x-y is also in Emacs 27.2.  It
> > would probably be catastrophic to fix posn-at-x-y, since so many
> > programs will have compensated for this bug.  So, we should probably fix
> > the doc of the function.

> Done on the emacs-28 branch.

Thanks!

> > But we can fix follow-calc-win-end, by replacing the form at 2 with:

> >     (last-line-pos (posn-point (+ (posn-at-x-y 0 (1- ht) win)
> >                                   (window-header-line-height win))))

Actually, that's not right.  It should be

(last-line-pos (posn-point (posn-at-x-y 
                            0 (+ (1- ht) (window-header-line-height
			                  win)))))
, but that's a mere detail.  It appears to solve much of Juri's bug.

> What about the tab-line (which AFAIU was the trigger for this bug)?

Yes, that needs to be incorporated, too.

The other hunk of Juri's patch, in follow-scroll-down, is needed, but I
don't think it's quite right when combined with my suggestion for
follow-calc-win-end above.

> > And I think we (probably me ;-) should go through the elisp manual and
> > doc strings replacing vague phrases like "the text area of the window"
> > with explicit descriptions involving "the header line", etc.

> That'd be going overboard.  We could place a cross-reference in some
> of those places to the "Frame Layout" node, though.  Suggestions for
> such places are welcome.

OK.  But I think there's confusion in the manual and doc strings, and
even the code, and that it's not just me.

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2021-11-06 11:50 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   ` bug#51590: follow-mode is broken with header-line and tab-line Juri Linkov
2021-11-04 18:46     ` 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 [this message]
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=YYZsGBOtJeDHyn1H@ACM \
    --to=acm@muc.de \
    --cc=51590@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    /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).