diff options
author | Eli Zaretskii <eliz@gnu.org> | 2014-09-02 18:16:42 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2014-09-02 18:16:42 +0300 |
commit | 5735a30d59af16ba004a151b6e0a4c18ba1d481e (patch) | |
tree | c67e14bbc54df245f8109485677589362031844d /src/dispnew.c | |
parent | 5597a7d4e2a69b6777c023e0eae888b7ffd7d566 (diff) | |
download | emacs-5735a30d59af16ba004a151b6e0a4c18ba1d481e.tar.gz |
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.
Diffstat (limited to 'src/dispnew.c')
-rw-r--r-- | src/dispnew.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index e6ab5bf1e9c..9725068c72b 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -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]) |