mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-18 10:16:51 +00:00
(fast_find_position): Special case if POS is end of buffer.
This commit is contained in:
parent
163638a8a9
commit
77b686467c
17
src/xterm.c
17
src/xterm.c
@ -2018,6 +2018,7 @@ fast_find_position (window, pos, columnp, rowp)
|
||||
int width = window_internal_width (w);
|
||||
int *charstarts;
|
||||
int lastcol;
|
||||
int maybe_next_line = 0;
|
||||
|
||||
/* Find the right row. */
|
||||
for (i = 0;
|
||||
@ -2027,6 +2028,13 @@ fast_find_position (window, pos, columnp, rowp)
|
||||
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;
|
||||
}
|
||||
@ -2048,6 +2056,15 @@ fast_find_position (window, pos, columnp, rowp)
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user