From 352ec8ffdd1ef4e5f335b921e0590ff746bebd5d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 8 Oct 2011 12:58:50 +0200 Subject: [PATCH] Fix bug #4426 with buffer_posn_from_coords when header line is present. dispnew.c (buffer_posn_from_coords): Account it.vpos for a possible presence of header-line. --- src/ChangeLog | 5 +++++ src/dispnew.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 38c452f354e..edfecaa0930 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-10-08 Eli Zaretskii + + * dispnew.c (buffer_posn_from_coords): Account for a possible + presence of header-line. (Bug#4426) + 2011-10-07 Stefan Monnier * buffer.c (syms_of_buffer) : Don't diff --git a/src/dispnew.c b/src/dispnew.c index 51b17fc0f11..46d1917b144 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5261,6 +5261,10 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p CHARPOS (startp) = min (ZV, max (BEGV, CHARPOS (startp))); BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp))); start_display (&it, w, startp); + /* start_display takes into account the header-line row, but IT's + vpos still counts from the glyph row that includes the window's + start position. Adjust for a possible header-line row. */ + it.vpos += WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0; x0 = *x; -- 2.39.2