int width = window_internal_width (w);
int *charstarts;
int lastcol;
+ int maybe_next_line = 0;
/* Find the right row. */
for (i = 0;
int linestart = FRAME_CURRENT_GLYPHS (f)->charstarts[top + i][left];
if (linestart > pos)
break;
+ /* If the position sought is the end of the buffer,
+ don't include the blank lines at the bottom of the window. */
+ if (linestart == pos && pos == BUF_ZV (XBUFFER (w->buffer)))
+ {
+ maybe_next_line = 1;
+ break;
+ }
if (linestart > 0)
row = i;
}
lastcol = left + i;
}
+ /* If we're looking for the end of the buffer,
+ and we didn't find it in the line we scanned,
+ use the start of the following line. */
+ if (maybe_next_line)
+ {
+ row++;
+ i = 0;
+ }
+
*rowp = row + top;
*columnp = lastcol;
return 0;