From: Richard M. Stallman Date: Tue, 1 Nov 1994 00:07:34 +0000 (+0000) Subject: (fast_find_position): Special case if POS is end of buffer. X-Git-Tag: emacs-19.34~6093 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=77b686467ca3f515fa432e4cec17a2eb3587371e;p=emacs.git (fast_find_position): Special case if POS is end of buffer. --- diff --git a/src/xterm.c b/src/xterm.c index f17efc2c488..5f560b239fe 100644 --- a/src/xterm.c +++ b/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;