Commit 5735a30d authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

Fix bug #18384 with incorrect reporting of row number by posn-col-row.

 lisp/subr.el (posn-col-row): Revert the change from commit
 2010-11-13T21:07:58Z!eliz@gnu.org, which
 was inadvertently merged from emacs-23 release branch in 
2010-11-18T03:54:14Z!monnier@iro.umontreal.ca, and
 introduced an off-by-one error in the reported row when there is a
 header line.

 src/dispnew.c (buffer_posn_from_coords): Fix an off-by-one error in
 the reported row in the case of a window with a header line, by
 improving on the fix committed in 2011-10-08T10:58:50Z!eliz@gnu.org
 eliz@gnu.org-20111008105850-ht4tvsayohvr1kjc.
parent 5597a7d4
2014-09-02 Eli Zaretskii <eliz@gnu.org>
* subr.el (posn-col-row): Revert the change from commit
2010-11-13T21:07:58Z!eliz@gnu.org, which
was inadvertently merged from emacs-23 release branch in 2010-11-18T03:54:14Z!monnier@iro.umontreal.ca
monnier@iro.umontreal.ca-20101118035414-yvlg7k7dk4k4l3q, and
introduced an off-by-one error in the reported row when there is a
header line. (Bug#18384)
2014-09-01 Fabián Ezequiel Gallina <fgallina@gnu.org>
* progmodes/python.el (python-indent-post-self-insert-function):
......
......@@ -1146,10 +1146,7 @@ and `event-end' functions."
((null spacing)
(setq spacing 0)))
(cons (/ (car pair) (frame-char-width frame))
(- (/ (cdr pair) (+ (frame-char-height frame) spacing))
(if (null (with-current-buffer (window-buffer window)
header-line-format))
0 1))))))))
(/ (cdr pair) (+ (frame-char-height frame) spacing))))))))
(defun posn-actual-col-row (position)
"Return the actual column and row in POSITION, measured in characters.
......
2014-09-02 Eli Zaretskii <eliz@gnu.org>
* dispnew.c (buffer_posn_from_coords): Fix an off-by-one error in
the reported row in the case of a window with a header line, by
improving on the fix committed in 2011-10-08T10:58:50Z!eliz@gnu.org
eliz@gnu.org-20111008105850-ht4tvsayohvr1kjc. (Bug#18384)
2014-09-02 Paul Eggert <eggert@cs.ucla.edu>
* eval.c (internal_lisp_condition_case): Don't overrun the stack
......
......@@ -5107,7 +5107,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
#ifdef HAVE_WINDOW_SYSTEM
struct image *img = 0;
#endif
int x0, x1, to_x;
int x0, x1, to_x, it_vpos;
void *itdata = NULL;
/* We used to set current_buffer directly here, but that does the
......@@ -5116,11 +5116,6 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
itdata = bidi_shelve_cache ();
CLIP_TEXT_POS_FROM_MARKER (startp, w->start);
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);
x0 = *x;
/* First, move to the beginning of the row corresponding to *Y. We
......@@ -5190,8 +5185,13 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
}
#endif
if (it.vpos < w->current_matrix->nrows
&& (row = MATRIX_ROW (w->current_matrix, it.vpos),
/* IT's vpos counts from the glyph row that includes the window's
start position, i.e. it excludes the header-line row, but
MATRIX_ROW includes the header-line row. Adjust for a possible
header-line row. */
it_vpos = it.vpos + WINDOW_WANTS_MODELINE_P (w);
if (it_vpos < w->current_matrix->nrows
&& (row = MATRIX_ROW (w->current_matrix, it_vpos),
row->enabled_p))
{
if (it.hpos < row->used[TEXT_AREA])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment