# HG changeset patch # User Richard M. Stallman # Date 783648454 0 # Node ID 567e3670acc34f3461c9da8f49f7fc0aed36f593 # Parent 1a75c4fe2ecee962b617f682209b8a82de3d9eea (fast_find_position): Special case if POS is end of buffer. diff -r 1a75c4fe2ece -r 567e3670acc3 src/xterm.c --- a/src/xterm.c Mon Oct 31 21:50:17 1994 +0000 +++ b/src/xterm.c Tue Nov 01 00:07:34 1994 +0000 @@ -2018,6 +2018,7 @@ 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 @@ 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 @@ 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;