diff options
author | Richard M. Stallman <rms@gnu.org> | 1994-11-01 00:07:34 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1994-11-01 00:07:34 +0000 |
commit | 69b5ebd7a77e0bfc699b26398f0d9775c8d8e975 (patch) | |
tree | eaa595bf57ab41042c1f75e5acf7749e8c7be8d8 /src/xterm.c | |
parent | 003e50328fc3241981ccc30bdcca6e4327369909 (diff) | |
download | emacs-69b5ebd7a77e0bfc699b26398f0d9775c8d8e975.tar.gz |
(fast_find_position): Special case if POS is end of buffer.
Diffstat (limited to 'src/xterm.c')
-rw-r--r-- | src/xterm.c | 17 |
1 files changed, 17 insertions, 0 deletions
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; |