aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
authorRichard M. Stallman1994-11-01 00:07:34 +0000
committerRichard M. Stallman1994-11-01 00:07:34 +0000
commit77b686467ca3f515fa432e4cec17a2eb3587371e (patch)
treeb4a8c1e4a3608ccddc4a9806b5eec68a5eeae356 /src/xterm.c
parent163638a8a9c6156dca850d66618cfdd72dc24523 (diff)
downloademacs-77b686467ca3f515fa432e4cec17a2eb3587371e.tar.gz
emacs-77b686467ca3f515fa432e4cec17a2eb3587371e.zip
(fast_find_position): Special case if POS is end of buffer.
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c17
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)
2018 int width = window_internal_width (w); 2018 int width = window_internal_width (w);
2019 int *charstarts; 2019 int *charstarts;
2020 int lastcol; 2020 int lastcol;
2021 int maybe_next_line = 0;
2021 2022
2022 /* Find the right row. */ 2023 /* Find the right row. */
2023 for (i = 0; 2024 for (i = 0;
@@ -2027,6 +2028,13 @@ fast_find_position (window, pos, columnp, rowp)
2027 int linestart = FRAME_CURRENT_GLYPHS (f)->charstarts[top + i][left]; 2028 int linestart = FRAME_CURRENT_GLYPHS (f)->charstarts[top + i][left];
2028 if (linestart > pos) 2029 if (linestart > pos)
2029 break; 2030 break;
2031 /* If the position sought is the end of the buffer,
2032 don't include the blank lines at the bottom of the window. */
2033 if (linestart == pos && pos == BUF_ZV (XBUFFER (w->buffer)))
2034 {
2035 maybe_next_line = 1;
2036 break;
2037 }
2030 if (linestart > 0) 2038 if (linestart > 0)
2031 row = i; 2039 row = i;
2032 } 2040 }
@@ -2048,6 +2056,15 @@ fast_find_position (window, pos, columnp, rowp)
2048 lastcol = left + i; 2056 lastcol = left + i;
2049 } 2057 }
2050 2058
2059 /* If we're looking for the end of the buffer,
2060 and we didn't find it in the line we scanned,
2061 use the start of the following line. */
2062 if (maybe_next_line)
2063 {
2064 row++;
2065 i = 0;
2066 }
2067
2051 *rowp = row + top; 2068 *rowp = row + top;
2052 *columnp = lastcol; 2069 *columnp = lastcol;
2053 return 0; 2070 return 0;