unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>
Cc: acm@muc.de, 51590@debbugs.gnu.org, juri@linkov.net
Subject: bug#51590: follow-mode is broken with header-line and tab-line
Date: Mon, 8 Nov 2021 18:32:20 +0100	[thread overview]
Message-ID: <70ed9026-8c9b-a8cb-ab62-cb800ddac44d@gmx.at> (raw)
In-Reply-To: <db5ff87d-7ed4-f10c-d42a-3ac2da41451a@gmx.at>

[-- Attachment #1: Type: text/plain, Size: 518 bytes --]

 > (posn-area (posn-at-x-y (1- (window-pixel-width)) 0))
 >
 > currently gives 'nil' regardless of whether it's done with a header or
 > tab line and
 >
 > (posn-area (posn-at-x-y
 >          (1- (window-pixel-width))
 >          (1- (window-pixel-height))))
 >
 > gives 'nil' on the mode line.  Only when I remove _both_ fringes and the
 > vertical scroll bar I get the expected results.  This _is_ a bug and we
 > should fix it.

I think the attached patch should fix that modulo some ">=" and "<"
glitches.

martin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: posn-at-x-y.diff --]
[-- Type: text/x-patch; name="posn-at-x-y.diff", Size: 1230 bytes --]

diff --git a/src/keyboard.c b/src/keyboard.c
index a99d14cb4c..d24a0ffe07 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -11374,7 +11374,9 @@ DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, 2, 4, 0,

       XSETINT (x, (XFIXNUM (x)
 		   + WINDOW_LEFT_EDGE_X (w)
-		   + (NILP (whole)
+		   + ((NILP (whole)
+		       && XFIXNUM (y) >= WINDOW_BOX_TOP_PIXEL_EDGE (w)
+		       && XFIXNUM (y) < WINDOW_BOX_HEIGHT_NO_MODE_LINE (w))
 		      ? window_box_left_offset (w, TEXT_AREA)
 		      : 0)));
       XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XFIXNUM (y)));
diff --git a/src/window.h b/src/window.h
index 2400c422c1..6420706b5f 100644
--- a/src/window.h
+++ b/src/window.h
@@ -800,6 +800,12 @@ #define WINDOW_BOX_RIGHT_PIXEL_EDGE(W)		\
    - WINDOW_RIGHT_DIVIDER_WIDTH (W)		\
    - WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (W))

+/* Return the pixel value where the text in window W starts.  */
+#define WINDOW_BOX_TOP_PIXEL_EDGE(W)		\
+  (WINDOW_TOP_PIXEL_EDGE (W)			\
+   + WINDOW_HEADER_LINE_HEIGHT (W)		\
+   + WINDOW_TAB_LINE_HEIGHT (W))
+
 /* Return the frame x-position at which the text (or left fringe) in
    window W starts.  This does not include a left-hand scroll bar if
    any.  */

  reply	other threads:[~2021-11-08 17:32 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
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 [this message]
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=70ed9026-8c9b-a8cb-ab62-cb800ddac44d@gmx.at \
    --to=rudalics@gmx.at \
    --cc=51590@debbugs.gnu.org \
    --cc=acm@muc.de \
    --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).