diff options
| author | Eli Zaretskii | 2014-09-02 18:16:42 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-09-02 18:16:42 +0300 |
| commit | 5735a30d59af16ba004a151b6e0a4c18ba1d481e (patch) | |
| tree | c67e14bbc54df245f8109485677589362031844d /src | |
| parent | 5597a7d4e2a69b6777c023e0eae888b7ffd7d566 (diff) | |
| download | emacs-5735a30d59af16ba004a151b6e0a4c18ba1d481e.tar.gz emacs-5735a30d59af16ba004a151b6e0a4c18ba1d481e.zip | |
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')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/dispnew.c | 16 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5e3ec8aa597..5f00b654261 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2014-09-02 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * dispnew.c (buffer_posn_from_coords): Fix an off-by-one error in | ||
| 4 | the reported row in the case of a window with a header line, by | ||
| 5 | improving on the fix committed in 2011-10-08T10:58:50Z!eliz@gnu.org | ||
| 6 | eliz@gnu.org-20111008105850-ht4tvsayohvr1kjc. (Bug#18384) | ||
| 7 | |||
| 1 | 2014-09-02 Paul Eggert <eggert@cs.ucla.edu> | 8 | 2014-09-02 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 9 | ||
| 3 | * eval.c (internal_lisp_condition_case): Don't overrun the stack | 10 | * eval.c (internal_lisp_condition_case): Don't overrun the stack |
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 | |||
| 5107 | #ifdef HAVE_WINDOW_SYSTEM | 5107 | #ifdef HAVE_WINDOW_SYSTEM |
| 5108 | struct image *img = 0; | 5108 | struct image *img = 0; |
| 5109 | #endif | 5109 | #endif |
| 5110 | int x0, x1, to_x; | 5110 | int x0, x1, to_x, it_vpos; |
| 5111 | void *itdata = NULL; | 5111 | void *itdata = NULL; |
| 5112 | 5112 | ||
| 5113 | /* We used to set current_buffer directly here, but that does the | 5113 | /* 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 | |||
| 5116 | itdata = bidi_shelve_cache (); | 5116 | itdata = bidi_shelve_cache (); |
| 5117 | CLIP_TEXT_POS_FROM_MARKER (startp, w->start); | 5117 | CLIP_TEXT_POS_FROM_MARKER (startp, w->start); |
| 5118 | start_display (&it, w, startp); | 5118 | start_display (&it, w, startp); |
| 5119 | /* start_display takes into account the header-line row, but IT's | ||
| 5120 | vpos still counts from the glyph row that includes the window's | ||
| 5121 | start position. Adjust for a possible header-line row. */ | ||
| 5122 | it.vpos += WINDOW_WANTS_HEADER_LINE_P (w); | ||
| 5123 | |||
| 5124 | x0 = *x; | 5119 | x0 = *x; |
| 5125 | 5120 | ||
| 5126 | /* First, move to the beginning of the row corresponding to *Y. We | 5121 | /* 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 | |||
| 5190 | } | 5185 | } |
| 5191 | #endif | 5186 | #endif |
| 5192 | 5187 | ||
| 5193 | if (it.vpos < w->current_matrix->nrows | 5188 | /* IT's vpos counts from the glyph row that includes the window's |
| 5194 | && (row = MATRIX_ROW (w->current_matrix, it.vpos), | 5189 | start position, i.e. it excludes the header-line row, but |
| 5190 | MATRIX_ROW includes the header-line row. Adjust for a possible | ||
| 5191 | header-line row. */ | ||
| 5192 | it_vpos = it.vpos + WINDOW_WANTS_MODELINE_P (w); | ||
| 5193 | if (it_vpos < w->current_matrix->nrows | ||
| 5194 | && (row = MATRIX_ROW (w->current_matrix, it_vpos), | ||
| 5195 | row->enabled_p)) | 5195 | row->enabled_p)) |
| 5196 | { | 5196 | { |
| 5197 | if (it.hpos < row->used[TEXT_AREA]) | 5197 | if (it.hpos < row->used[TEXT_AREA]) |