diff options
| author | Dmitry Antipov | 2013-08-14 09:41:48 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-08-14 09:41:48 +0400 |
| commit | 02455cb66aa80f361bafada7b1286f2dd79739d1 (patch) | |
| tree | 93a894a36309f4c1385c0ec28a26c2ce3c611ee4 /src | |
| parent | da5707e8ec8df0a8a9bb1a1f12c6b701314845cc (diff) | |
| download | emacs-02455cb66aa80f361bafada7b1286f2dd79739d1.tar.gz emacs-02455cb66aa80f361bafada7b1286f2dd79739d1.zip | |
* window.h (struct window): Convert window_end_pos and
window_end_vpos from Lisp_Object to ptrdiff_t and int, respectively.
(wset_window_end_pos, wset_window_end_vpos): Remove.
* dispnew.c (adjust_glyph_matrix):
* window.c (Fwindow_end, replace_window, set_window_buffer)
(make_window):
* xdisp.c (check_window_end, move_it_to, redisplay_internal)
(set_vertical_scroll_bar, redisplay_window, try_window)
(try_window_reusing_current_matrix, find_first_unchanged_at_end_row)
(try_window_id, decode_mode_spec, mouse_face_from_buffer_pos)
(note_mouse_highlight): Adjust users.
(try_cursor_movement): Likewise. Convert old precondition to eassert.
Add comment.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 16 | ||||
| -rw-r--r-- | src/dispnew.c | 3 | ||||
| -rw-r--r-- | src/window.c | 12 | ||||
| -rw-r--r-- | src/window.h | 26 | ||||
| -rw-r--r-- | src/xdisp.c | 150 |
5 files changed, 94 insertions, 113 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index cf73204c55c..52fd1db4102 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,21 @@ | |||
| 1 | 2013-08-14 Dmitry Antipov <dmantipov@yandex.ru> | 1 | 2013-08-14 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 2 | ||
| 3 | * window.h (struct window): Convert window_end_pos and | ||
| 4 | window_end_vpos from Lisp_Object to ptrdiff_t and int, respectively. | ||
| 5 | (wset_window_end_pos, wset_window_end_vpos): Remove. | ||
| 6 | * dispnew.c (adjust_glyph_matrix): | ||
| 7 | * window.c (Fwindow_end, replace_window, set_window_buffer) | ||
| 8 | (make_window): | ||
| 9 | * xdisp.c (check_window_end, move_it_to, redisplay_internal) | ||
| 10 | (set_vertical_scroll_bar, redisplay_window, try_window) | ||
| 11 | (try_window_reusing_current_matrix, find_first_unchanged_at_end_row) | ||
| 12 | (try_window_id, decode_mode_spec, mouse_face_from_buffer_pos) | ||
| 13 | (note_mouse_highlight): Adjust users. | ||
| 14 | (try_cursor_movement): Likewise. Convert old precondition to eassert. | ||
| 15 | Add comment. | ||
| 16 | |||
| 17 | 2013-08-14 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 18 | |||
| 3 | Fix --enable-gcc-warnings errors introduced in 2013-08-13 commit. | 19 | Fix --enable-gcc-warnings errors introduced in 2013-08-13 commit. |
| 4 | * image.c (imagemagick_filename_hint): Use `const char *' and | 20 | * image.c (imagemagick_filename_hint): Use `const char *' and |
| 5 | prefer SSDATA to SDATA to avoid warnings. | 21 | prefer SSDATA to SDATA to avoid warnings. |
diff --git a/src/dispnew.c b/src/dispnew.c index 9b93a31e0b1..b7e44e425bf 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -598,8 +598,7 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y | |||
| 598 | 598 | ||
| 599 | /* Window end is invalid, if inside of the rows that | 599 | /* Window end is invalid, if inside of the rows that |
| 600 | are invalidated below. */ | 600 | are invalidated below. */ |
| 601 | if (INTEGERP (w->window_end_vpos) | 601 | if (w->window_end_vpos >= i) |
| 602 | && XFASTINT (w->window_end_vpos) >= i) | ||
| 603 | w->window_end_valid = 0; | 602 | w->window_end_valid = 0; |
| 604 | 603 | ||
| 605 | while (i < matrix->nrows) | 604 | while (i < matrix->nrows) |
diff --git a/src/window.c b/src/window.c index d07eed86a1c..b295f748bfd 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -1539,7 +1539,7 @@ if it isn't already recorded. */) | |||
| 1539 | set_buffer_internal (old_buffer); | 1539 | set_buffer_internal (old_buffer); |
| 1540 | } | 1540 | } |
| 1541 | else | 1541 | else |
| 1542 | XSETINT (value, BUF_Z (b) - XFASTINT (w->window_end_pos)); | 1542 | XSETINT (value, BUF_Z (b) - w->window_end_pos); |
| 1543 | 1543 | ||
| 1544 | return value; | 1544 | return value; |
| 1545 | } | 1545 | } |
| @@ -2033,8 +2033,8 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag) | |||
| 2033 | n->phys_cursor_width = -1; | 2033 | n->phys_cursor_width = -1; |
| 2034 | n->must_be_updated_p = 0; | 2034 | n->must_be_updated_p = 0; |
| 2035 | n->pseudo_window_p = 0; | 2035 | n->pseudo_window_p = 0; |
| 2036 | wset_window_end_vpos (n, make_number (0)); | 2036 | n->window_end_vpos = 0; |
| 2037 | wset_window_end_pos (n, make_number (0)); | 2037 | n->window_end_pos = 0; |
| 2038 | n->window_end_valid = 0; | 2038 | n->window_end_valid = 0; |
| 2039 | } | 2039 | } |
| 2040 | 2040 | ||
| @@ -3170,8 +3170,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, | |||
| 3170 | bset_display_count (b, make_number (XINT (BVAR (b, display_count)) + 1)); | 3170 | bset_display_count (b, make_number (XINT (BVAR (b, display_count)) + 1)); |
| 3171 | bset_display_time (b, Fcurrent_time ()); | 3171 | bset_display_time (b, Fcurrent_time ()); |
| 3172 | 3172 | ||
| 3173 | wset_window_end_pos (w, make_number (0)); | 3173 | w->window_end_pos = 0; |
| 3174 | wset_window_end_vpos (w, make_number (0)); | 3174 | w->window_end_vpos = 0; |
| 3175 | memset (&w->last_cursor, 0, sizeof w->last_cursor); | 3175 | memset (&w->last_cursor, 0, sizeof w->last_cursor); |
| 3176 | 3176 | ||
| 3177 | if (!(keep_margins_p && samebuf)) | 3177 | if (!(keep_margins_p && samebuf)) |
| @@ -3437,8 +3437,6 @@ make_window (void) | |||
| 3437 | wset_start (w, Fmake_marker ()); | 3437 | wset_start (w, Fmake_marker ()); |
| 3438 | wset_pointm (w, Fmake_marker ()); | 3438 | wset_pointm (w, Fmake_marker ()); |
| 3439 | wset_vertical_scroll_bar_type (w, Qt); | 3439 | wset_vertical_scroll_bar_type (w, Qt); |
| 3440 | wset_window_end_pos (w, make_number (0)); | ||
| 3441 | wset_window_end_vpos (w, make_number (0)); | ||
| 3442 | /* These Lisp fields are marked specially so they're not set to nil by | 3440 | /* These Lisp fields are marked specially so they're not set to nil by |
| 3443 | allocate_window. */ | 3441 | allocate_window. */ |
| 3444 | wset_prev_buffers (w, Qnil); | 3442 | wset_prev_buffers (w, Qnil); |
diff --git a/src/window.h b/src/window.h index 823fe678c43..585697f0805 100644 --- a/src/window.h +++ b/src/window.h | |||
| @@ -145,14 +145,6 @@ struct window | |||
| 145 | no scroll bar. A value of t means use frame value. */ | 145 | no scroll bar. A value of t means use frame value. */ |
| 146 | Lisp_Object vertical_scroll_bar_type; | 146 | Lisp_Object vertical_scroll_bar_type; |
| 147 | 147 | ||
| 148 | /* Z - the buffer position of the last glyph in the current | ||
| 149 | matrix of W. Only valid if window_end_valid is nonzero. */ | ||
| 150 | Lisp_Object window_end_pos; | ||
| 151 | |||
| 152 | /* Glyph matrix row of the last glyph in the current matrix | ||
| 153 | of W. Only valid if window_end_valid is nonzero. */ | ||
| 154 | Lisp_Object window_end_vpos; | ||
| 155 | |||
| 156 | /* Display-table to use for displaying chars in this window. | 148 | /* Display-table to use for displaying chars in this window. |
| 157 | Nil means use the buffer's own display-table. */ | 149 | Nil means use the buffer's own display-table. */ |
| 158 | Lisp_Object display_table; | 150 | Lisp_Object display_table; |
| @@ -269,6 +261,14 @@ struct window | |||
| 269 | A value of -1 means use frame values. */ | 261 | A value of -1 means use frame values. */ |
| 270 | int scroll_bar_width; | 262 | int scroll_bar_width; |
| 271 | 263 | ||
| 264 | /* Z - the buffer position of the last glyph in the current | ||
| 265 | matrix of W. Only valid if window_end_valid is nonzero. */ | ||
| 266 | ptrdiff_t window_end_pos; | ||
| 267 | |||
| 268 | /* Glyph matrix row of the last glyph in the current matrix | ||
| 269 | of W. Only valid if window_end_valid is nonzero. */ | ||
| 270 | int window_end_vpos; | ||
| 271 | |||
| 272 | /* Non-zero if this window is a minibuffer window. */ | 272 | /* Non-zero if this window is a minibuffer window. */ |
| 273 | unsigned mini : 1; | 273 | unsigned mini : 1; |
| 274 | 274 | ||
| @@ -366,16 +366,6 @@ wset_vertical_scroll_bar (struct window *w, Lisp_Object val) | |||
| 366 | w->vertical_scroll_bar = val; | 366 | w->vertical_scroll_bar = val; |
| 367 | } | 367 | } |
| 368 | WINDOW_INLINE void | 368 | WINDOW_INLINE void |
| 369 | wset_window_end_pos (struct window *w, Lisp_Object val) | ||
| 370 | { | ||
| 371 | w->window_end_pos = val; | ||
| 372 | } | ||
| 373 | WINDOW_INLINE void | ||
| 374 | wset_window_end_vpos (struct window *w, Lisp_Object val) | ||
| 375 | { | ||
| 376 | w->window_end_vpos = val; | ||
| 377 | } | ||
| 378 | WINDOW_INLINE void | ||
| 379 | wset_prev_buffers (struct window *w, Lisp_Object val) | 369 | wset_prev_buffers (struct window *w, Lisp_Object val) |
| 380 | { | 370 | { |
| 381 | w->prev_buffers = val; | 371 | w->prev_buffers = val; |
diff --git a/src/xdisp.c b/src/xdisp.c index de5fd6ef26a..a1b12b9f60e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2597,8 +2597,7 @@ check_window_end (struct window *w) | |||
| 2597 | if (!MINI_WINDOW_P (w) && w->window_end_valid) | 2597 | if (!MINI_WINDOW_P (w) && w->window_end_valid) |
| 2598 | { | 2598 | { |
| 2599 | struct glyph_row *row; | 2599 | struct glyph_row *row; |
| 2600 | eassert ((row = MATRIX_ROW (w->current_matrix, | 2600 | eassert ((row = MATRIX_ROW (w->current_matrix, w->window_end_vpos), |
| 2601 | XFASTINT (w->window_end_vpos)), | ||
| 2602 | !row->enabled_p | 2601 | !row->enabled_p |
| 2603 | || MATRIX_ROW_DISPLAYS_TEXT_P (row) | 2602 | || MATRIX_ROW_DISPLAYS_TEXT_P (row) |
| 2604 | || MATRIX_ROW_VPOS (row, w->current_matrix) == 0)); | 2603 | || MATRIX_ROW_VPOS (row, w->current_matrix) == 0)); |
| @@ -9054,7 +9053,7 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos | |||
| 9054 | && it->current_x == it->last_visible_x - 1 | 9053 | && it->current_x == it->last_visible_x - 1 |
| 9055 | && it->c != '\n' | 9054 | && it->c != '\n' |
| 9056 | && it->c != '\t' | 9055 | && it->c != '\t' |
| 9057 | && it->vpos < XFASTINT (it->w->window_end_vpos)) | 9056 | && it->vpos < it->w->window_end_vpos) |
| 9058 | { | 9057 | { |
| 9059 | it->continuation_lines_width += it->current_x; | 9058 | it->continuation_lines_width += it->current_x; |
| 9060 | it->current_x = it->hpos = it->max_ascent = it->max_descent = 0; | 9059 | it->current_x = it->hpos = it->max_ascent = it->max_descent = 0; |
| @@ -13268,12 +13267,12 @@ redisplay_internal (void) | |||
| 13268 | adjusted. */ | 13267 | adjusted. */ |
| 13269 | if (MATRIX_ROW_DISPLAYS_TEXT_P (it.glyph_row - 1)) | 13268 | if (MATRIX_ROW_DISPLAYS_TEXT_P (it.glyph_row - 1)) |
| 13270 | { | 13269 | { |
| 13271 | if (XFASTINT (w->window_end_vpos) < this_line_vpos) | 13270 | if (w->window_end_vpos < this_line_vpos) |
| 13272 | wset_window_end_vpos (w, make_number (this_line_vpos)); | 13271 | w->window_end_vpos = this_line_vpos; |
| 13273 | } | 13272 | } |
| 13274 | else if (XFASTINT (w->window_end_vpos) == this_line_vpos | 13273 | else if (w->window_end_vpos == this_line_vpos |
| 13275 | && this_line_vpos > 0) | 13274 | && this_line_vpos > 0) |
| 13276 | wset_window_end_vpos (w, make_number (this_line_vpos - 1)); | 13275 | w->window_end_vpos = this_line_vpos - 1; |
| 13277 | w->window_end_valid = 0; | 13276 | w->window_end_valid = 0; |
| 13278 | 13277 | ||
| 13279 | /* Update hint: No need to try to scroll in update_window. */ | 13278 | /* Update hint: No need to try to scroll in update_window. */ |
| @@ -14956,6 +14955,10 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste | |||
| 14956 | if-statement below. Now, this field is converted to | 14955 | if-statement below. Now, this field is converted to |
| 14957 | ptrdiff_t, thus zero means invalid position in a buffer. */ | 14956 | ptrdiff_t, thus zero means invalid position in a buffer. */ |
| 14958 | eassert (w->last_point > 0); | 14957 | eassert (w->last_point > 0); |
| 14958 | /* Likewise there was a check whether window_end_vpos is nil or larger | ||
| 14959 | than the window. Now window_end_vpos is int and so never nil, but | ||
| 14960 | let's leave eassert to check whether it fits in the window. */ | ||
| 14961 | eassert (w->window_end_vpos < w->current_matrix->nrows); | ||
| 14959 | 14962 | ||
| 14960 | /* Handle case where text has not changed, only point, and it has | 14963 | /* Handle case where text has not changed, only point, and it has |
| 14961 | not moved off the frame. */ | 14964 | not moved off the frame. */ |
| @@ -14983,13 +14986,6 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste | |||
| 14983 | since the handling of this_line_start_pos, etc., in redisplay | 14986 | since the handling of this_line_start_pos, etc., in redisplay |
| 14984 | handles the same cases. */ | 14987 | handles the same cases. */ |
| 14985 | && !EQ (window, minibuf_window) | 14988 | && !EQ (window, minibuf_window) |
| 14986 | /* When splitting windows or for new windows, it happens that | ||
| 14987 | redisplay is called with a nil window_end_vpos or one being | ||
| 14988 | larger than the window. This should really be fixed in | ||
| 14989 | window.c. I don't have this on my list, now, so we do | ||
| 14990 | approximately the same as the old redisplay code. --gerd. */ | ||
| 14991 | && INTEGERP (w->window_end_vpos) | ||
| 14992 | && XFASTINT (w->window_end_vpos) < w->current_matrix->nrows | ||
| 14993 | && (FRAME_WINDOW_P (f) | 14989 | && (FRAME_WINDOW_P (f) |
| 14994 | || !overlay_arrow_in_current_buffer_p ())) | 14990 | || !overlay_arrow_in_current_buffer_p ())) |
| 14995 | { | 14991 | { |
| @@ -15303,7 +15299,7 @@ set_vertical_scroll_bar (struct window *w) | |||
| 15303 | start = marker_position (w->start) - BUF_BEGV (buf); | 15299 | start = marker_position (w->start) - BUF_BEGV (buf); |
| 15304 | /* I don't think this is guaranteed to be right. For the | 15300 | /* I don't think this is guaranteed to be right. For the |
| 15305 | moment, we'll pretend it is. */ | 15301 | moment, we'll pretend it is. */ |
| 15306 | end = BUF_Z (buf) - XFASTINT (w->window_end_pos) - BUF_BEGV (buf); | 15302 | end = BUF_Z (buf) - w->window_end_pos - BUF_BEGV (buf); |
| 15307 | 15303 | ||
| 15308 | if (end < start) | 15304 | if (end < start) |
| 15309 | end = start; | 15305 | end = start; |
| @@ -15993,7 +15989,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 15993 | line.) */ | 15989 | line.) */ |
| 15994 | if (w->cursor.vpos < 0) | 15990 | if (w->cursor.vpos < 0) |
| 15995 | { | 15991 | { |
| 15996 | if (w->window_end_valid && PT >= Z - XFASTINT (w->window_end_pos)) | 15992 | if (w->window_end_valid && PT >= Z - w->window_end_pos) |
| 15997 | { | 15993 | { |
| 15998 | clear_glyph_matrix (w->desired_matrix); | 15994 | clear_glyph_matrix (w->desired_matrix); |
| 15999 | move_it_by_lines (&it, 1); | 15995 | move_it_by_lines (&it, 1); |
| @@ -16286,8 +16282,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) | |||
| 16286 | } | 16282 | } |
| 16287 | 16283 | ||
| 16288 | /* If bottom moved off end of frame, change mode line percentage. */ | 16284 | /* If bottom moved off end of frame, change mode line percentage. */ |
| 16289 | if (XFASTINT (w->window_end_pos) <= 0 | 16285 | if (w->window_end_pos <= 0 && Z != IT_CHARPOS (it)) |
| 16290 | && Z != IT_CHARPOS (it)) | ||
| 16291 | w->update_mode_line = 1; | 16286 | w->update_mode_line = 1; |
| 16292 | 16287 | ||
| 16293 | /* Set window_end_pos to the offset of the last character displayed | 16288 | /* Set window_end_pos to the offset of the last character displayed |
| @@ -16296,21 +16291,18 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) | |||
| 16296 | if (last_text_row) | 16291 | if (last_text_row) |
| 16297 | { | 16292 | { |
| 16298 | eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row)); | 16293 | eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row)); |
| 16299 | w->window_end_bytepos | 16294 | w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); |
| 16300 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); | 16295 | w->window_end_pos = Z - MATRIX_ROW_END_CHARPOS (last_text_row); |
| 16301 | wset_window_end_pos | 16296 | w->window_end_vpos = MATRIX_ROW_VPOS (last_text_row, w->desired_matrix); |
| 16302 | (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); | ||
| 16303 | wset_window_end_vpos | ||
| 16304 | (w, make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix))); | ||
| 16305 | eassert | 16297 | eassert |
| 16306 | (MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->desired_matrix, | 16298 | (MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->desired_matrix, |
| 16307 | XFASTINT (w->window_end_vpos)))); | 16299 | w->window_end_vpos))); |
| 16308 | } | 16300 | } |
| 16309 | else | 16301 | else |
| 16310 | { | 16302 | { |
| 16311 | w->window_end_bytepos = Z_BYTE - ZV_BYTE; | 16303 | w->window_end_bytepos = Z_BYTE - ZV_BYTE; |
| 16312 | wset_window_end_pos (w, make_number (Z - ZV)); | 16304 | w->window_end_pos = Z - ZV; |
| 16313 | wset_window_end_vpos (w, make_number (0)); | 16305 | w->window_end_vpos = 0; |
| 16314 | } | 16306 | } |
| 16315 | 16307 | ||
| 16316 | /* But that is not valid info until redisplay finishes. */ | 16308 | /* But that is not valid info until redisplay finishes. */ |
| @@ -16537,29 +16529,26 @@ try_window_reusing_current_matrix (struct window *w) | |||
| 16537 | { | 16529 | { |
| 16538 | w->window_end_bytepos | 16530 | w->window_end_bytepos |
| 16539 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_reused_text_row); | 16531 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_reused_text_row); |
| 16540 | wset_window_end_pos | 16532 | w->window_end_pos |
| 16541 | (w, make_number (Z | 16533 | = Z - MATRIX_ROW_END_CHARPOS (last_reused_text_row); |
| 16542 | - MATRIX_ROW_END_CHARPOS (last_reused_text_row))); | 16534 | w->window_end_vpos |
| 16543 | wset_window_end_vpos | 16535 | = MATRIX_ROW_VPOS (last_reused_text_row, w->current_matrix); |
| 16544 | (w, make_number (MATRIX_ROW_VPOS (last_reused_text_row, | ||
| 16545 | w->current_matrix))); | ||
| 16546 | } | 16536 | } |
| 16547 | else if (last_text_row) | 16537 | else if (last_text_row) |
| 16548 | { | 16538 | { |
| 16549 | w->window_end_bytepos | 16539 | w->window_end_bytepos |
| 16550 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); | 16540 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); |
| 16551 | wset_window_end_pos | 16541 | w->window_end_pos |
| 16552 | (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); | 16542 | = Z - MATRIX_ROW_END_CHARPOS (last_text_row); |
| 16553 | wset_window_end_vpos | 16543 | w->window_end_vpos |
| 16554 | (w, make_number (MATRIX_ROW_VPOS (last_text_row, | 16544 | = MATRIX_ROW_VPOS (last_text_row, w->desired_matrix); |
| 16555 | w->desired_matrix))); | ||
| 16556 | } | 16545 | } |
| 16557 | else | 16546 | else |
| 16558 | { | 16547 | { |
| 16559 | /* This window must be completely empty. */ | 16548 | /* This window must be completely empty. */ |
| 16560 | w->window_end_bytepos = Z_BYTE - ZV_BYTE; | 16549 | w->window_end_bytepos = Z_BYTE - ZV_BYTE; |
| 16561 | wset_window_end_pos (w, make_number (Z - ZV)); | 16550 | w->window_end_pos = Z - ZV; |
| 16562 | wset_window_end_vpos (w, make_number (0)); | 16551 | w->window_end_vpos = 0; |
| 16563 | } | 16552 | } |
| 16564 | w->window_end_valid = 0; | 16553 | w->window_end_valid = 0; |
| 16565 | 16554 | ||
| @@ -16747,17 +16736,13 @@ try_window_reusing_current_matrix (struct window *w) | |||
| 16747 | { | 16736 | { |
| 16748 | w->window_end_bytepos | 16737 | w->window_end_bytepos |
| 16749 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); | 16738 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); |
| 16750 | wset_window_end_pos | 16739 | w->window_end_pos |
| 16751 | (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); | 16740 | = Z - MATRIX_ROW_END_CHARPOS (last_text_row); |
| 16752 | wset_window_end_vpos | 16741 | w->window_end_vpos |
| 16753 | (w, make_number (MATRIX_ROW_VPOS (last_text_row, | 16742 | = MATRIX_ROW_VPOS (last_text_row, w->desired_matrix); |
| 16754 | w->desired_matrix))); | ||
| 16755 | } | 16743 | } |
| 16756 | else | 16744 | else |
| 16757 | { | 16745 | w->window_end_vpos -= nrows_scrolled; |
| 16758 | wset_window_end_vpos | ||
| 16759 | (w, make_number (XFASTINT (w->window_end_vpos) - nrows_scrolled)); | ||
| 16760 | } | ||
| 16761 | 16746 | ||
| 16762 | w->window_end_valid = 0; | 16747 | w->window_end_valid = 0; |
| 16763 | w->desired_matrix->no_scrolling_p = 1; | 16748 | w->desired_matrix->no_scrolling_p = 1; |
| @@ -16897,11 +16882,11 @@ find_first_unchanged_at_end_row (struct window *w, | |||
| 16897 | /* A value of window_end_pos >= END_UNCHANGED means that the window | 16882 | /* A value of window_end_pos >= END_UNCHANGED means that the window |
| 16898 | end is in the range of changed text. If so, there is no | 16883 | end is in the range of changed text. If so, there is no |
| 16899 | unchanged row at the end of W's current matrix. */ | 16884 | unchanged row at the end of W's current matrix. */ |
| 16900 | if (XFASTINT (w->window_end_pos) >= END_UNCHANGED) | 16885 | if (w->window_end_pos >= END_UNCHANGED) |
| 16901 | return NULL; | 16886 | return NULL; |
| 16902 | 16887 | ||
| 16903 | /* Set row to the last row in W's current matrix displaying text. */ | 16888 | /* Set row to the last row in W's current matrix displaying text. */ |
| 16904 | row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); | 16889 | row = MATRIX_ROW (w->current_matrix, w->window_end_vpos); |
| 16905 | 16890 | ||
| 16906 | /* If matrix is entirely empty, no unchanged row exists. */ | 16891 | /* If matrix is entirely empty, no unchanged row exists. */ |
| 16907 | if (MATRIX_ROW_DISPLAYS_TEXT_P (row)) | 16892 | if (MATRIX_ROW_DISPLAYS_TEXT_P (row)) |
| @@ -16912,7 +16897,7 @@ find_first_unchanged_at_end_row (struct window *w, | |||
| 16912 | buffer positions in the current matrix to current buffer | 16897 | buffer positions in the current matrix to current buffer |
| 16913 | positions for characters not in changed text. */ | 16898 | positions for characters not in changed text. */ |
| 16914 | ptrdiff_t Z_old = | 16899 | ptrdiff_t Z_old = |
| 16915 | MATRIX_ROW_END_CHARPOS (row) + XFASTINT (w->window_end_pos); | 16900 | MATRIX_ROW_END_CHARPOS (row) + w->window_end_pos; |
| 16916 | ptrdiff_t Z_BYTE_old = | 16901 | ptrdiff_t Z_BYTE_old = |
| 16917 | MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos; | 16902 | MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos; |
| 16918 | ptrdiff_t last_unchanged_pos, last_unchanged_pos_old; | 16903 | ptrdiff_t last_unchanged_pos, last_unchanged_pos_old; |
| @@ -17246,7 +17231,7 @@ try_window_id (struct window *w) | |||
| 17246 | This case happens with stealth-fontification. Note that although | 17231 | This case happens with stealth-fontification. Note that although |
| 17247 | the display is unchanged, glyph positions in the matrix have to | 17232 | the display is unchanged, glyph positions in the matrix have to |
| 17248 | be adjusted, of course. */ | 17233 | be adjusted, of course. */ |
| 17249 | row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); | 17234 | row = MATRIX_ROW (w->current_matrix, w->window_end_vpos); |
| 17250 | if (MATRIX_ROW_DISPLAYS_TEXT_P (row) | 17235 | if (MATRIX_ROW_DISPLAYS_TEXT_P (row) |
| 17251 | && ((last_changed_charpos < CHARPOS (start) | 17236 | && ((last_changed_charpos < CHARPOS (start) |
| 17252 | && CHARPOS (start) == BEGV) | 17237 | && CHARPOS (start) == BEGV) |
| @@ -17258,7 +17243,7 @@ try_window_id (struct window *w) | |||
| 17258 | 17243 | ||
| 17259 | /* Compute how many chars/bytes have been added to or removed | 17244 | /* Compute how many chars/bytes have been added to or removed |
| 17260 | from the buffer. */ | 17245 | from the buffer. */ |
| 17261 | Z_old = MATRIX_ROW_END_CHARPOS (row) + XFASTINT (w->window_end_pos); | 17246 | Z_old = MATRIX_ROW_END_CHARPOS (row) + w->window_end_pos; |
| 17262 | Z_BYTE_old = MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos; | 17247 | Z_BYTE_old = MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos; |
| 17263 | Z_delta = Z - Z_old; | 17248 | Z_delta = Z - Z_old; |
| 17264 | Z_delta_bytes = Z_BYTE - Z_BYTE_old; | 17249 | Z_delta_bytes = Z_BYTE - Z_BYTE_old; |
| @@ -17329,10 +17314,8 @@ try_window_id (struct window *w) | |||
| 17329 | { | 17314 | { |
| 17330 | /* We have to compute the window end anew since text | 17315 | /* We have to compute the window end anew since text |
| 17331 | could have been added/removed after it. */ | 17316 | could have been added/removed after it. */ |
| 17332 | wset_window_end_pos | 17317 | w->window_end_pos = Z - MATRIX_ROW_END_CHARPOS (row); |
| 17333 | (w, make_number (Z - MATRIX_ROW_END_CHARPOS (row))); | 17318 | w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); |
| 17334 | w->window_end_bytepos | ||
| 17335 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); | ||
| 17336 | 17319 | ||
| 17337 | /* Set the cursor. */ | 17320 | /* Set the cursor. */ |
| 17338 | row = row_containing_pos (w, PT, r0, NULL, 0); | 17321 | row = row_containing_pos (w, PT, r0, NULL, 0); |
| @@ -17365,7 +17348,7 @@ try_window_id (struct window *w) | |||
| 17365 | 17348 | ||
| 17366 | /* Give up if the window ends in strings. Overlay strings | 17349 | /* Give up if the window ends in strings. Overlay strings |
| 17367 | at the end are difficult to handle, so don't try. */ | 17350 | at the end are difficult to handle, so don't try. */ |
| 17368 | row = MATRIX_ROW (current_matrix, XFASTINT (w->window_end_vpos)); | 17351 | row = MATRIX_ROW (current_matrix, w->window_end_vpos); |
| 17369 | if (MATRIX_ROW_START_CHARPOS (row) == MATRIX_ROW_END_CHARPOS (row)) | 17352 | if (MATRIX_ROW_START_CHARPOS (row) == MATRIX_ROW_END_CHARPOS (row)) |
| 17370 | GIVE_UP (20); | 17353 | GIVE_UP (20); |
| 17371 | 17354 | ||
| @@ -17711,7 +17694,7 @@ try_window_id (struct window *w) | |||
| 17711 | /* Set last_row to the glyph row in the current matrix where the | 17694 | /* Set last_row to the glyph row in the current matrix where the |
| 17712 | window end line is found. It has been moved up or down in | 17695 | window end line is found. It has been moved up or down in |
| 17713 | the matrix by dvpos. */ | 17696 | the matrix by dvpos. */ |
| 17714 | int last_vpos = XFASTINT (w->window_end_vpos) + dvpos; | 17697 | int last_vpos = w->window_end_vpos + dvpos; |
| 17715 | struct glyph_row *last_row = MATRIX_ROW (current_matrix, last_vpos); | 17698 | struct glyph_row *last_row = MATRIX_ROW (current_matrix, last_vpos); |
| 17716 | 17699 | ||
| 17717 | /* If last_row is the window end line, it should display text. */ | 17700 | /* If last_row is the window end line, it should display text. */ |
| @@ -17755,8 +17738,7 @@ try_window_id (struct window *w) | |||
| 17755 | } | 17738 | } |
| 17756 | 17739 | ||
| 17757 | /* Update window_end_pos and window_end_vpos. */ | 17740 | /* Update window_end_pos and window_end_vpos. */ |
| 17758 | if (first_unchanged_at_end_row | 17741 | if (first_unchanged_at_end_row && !last_text_row_at_end) |
| 17759 | && !last_text_row_at_end) | ||
| 17760 | { | 17742 | { |
| 17761 | /* Window end line if one of the preserved rows from the current | 17743 | /* Window end line if one of the preserved rows from the current |
| 17762 | matrix. Set row to the last row displaying text in current | 17744 | matrix. Set row to the last row displaying text in current |
| @@ -17767,22 +17749,20 @@ try_window_id (struct window *w) | |||
| 17767 | first_unchanged_at_end_row); | 17749 | first_unchanged_at_end_row); |
| 17768 | eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row)); | 17750 | eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row)); |
| 17769 | 17751 | ||
| 17770 | wset_window_end_pos (w, make_number (Z - MATRIX_ROW_END_CHARPOS (row))); | 17752 | w->window_end_pos = Z - MATRIX_ROW_END_CHARPOS (row); |
| 17771 | w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); | 17753 | w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); |
| 17772 | wset_window_end_vpos | 17754 | w->window_end_vpos = MATRIX_ROW_VPOS (row, w->current_matrix); |
| 17773 | (w, make_number (MATRIX_ROW_VPOS (row, w->current_matrix))); | ||
| 17774 | eassert (w->window_end_bytepos >= 0); | 17755 | eassert (w->window_end_bytepos >= 0); |
| 17775 | IF_DEBUG (debug_method_add (w, "A")); | 17756 | IF_DEBUG (debug_method_add (w, "A")); |
| 17776 | } | 17757 | } |
| 17777 | else if (last_text_row_at_end) | 17758 | else if (last_text_row_at_end) |
| 17778 | { | 17759 | { |
| 17779 | wset_window_end_pos | 17760 | w->window_end_pos |
| 17780 | (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end))); | 17761 | = Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end); |
| 17781 | w->window_end_bytepos | 17762 | w->window_end_bytepos |
| 17782 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row_at_end); | 17763 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row_at_end); |
| 17783 | wset_window_end_vpos | 17764 | w->window_end_vpos |
| 17784 | (w, make_number (MATRIX_ROW_VPOS (last_text_row_at_end, | 17765 | = MATRIX_ROW_VPOS (last_text_row_at_end, desired_matrix); |
| 17785 | desired_matrix))); | ||
| 17786 | eassert (w->window_end_bytepos >= 0); | 17766 | eassert (w->window_end_bytepos >= 0); |
| 17787 | IF_DEBUG (debug_method_add (w, "B")); | 17767 | IF_DEBUG (debug_method_add (w, "B")); |
| 17788 | } | 17768 | } |
| @@ -17791,12 +17771,11 @@ try_window_id (struct window *w) | |||
| 17791 | /* We have displayed either to the end of the window or at the | 17771 | /* We have displayed either to the end of the window or at the |
| 17792 | end of the window, i.e. the last row with text is to be found | 17772 | end of the window, i.e. the last row with text is to be found |
| 17793 | in the desired matrix. */ | 17773 | in the desired matrix. */ |
| 17794 | wset_window_end_pos | 17774 | w->window_end_pos |
| 17795 | (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); | 17775 | = Z - MATRIX_ROW_END_CHARPOS (last_text_row); |
| 17796 | w->window_end_bytepos | 17776 | w->window_end_bytepos |
| 17797 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); | 17777 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); |
| 17798 | wset_window_end_vpos | 17778 | w->window_end_vpos = MATRIX_ROW_VPOS (last_text_row, desired_matrix); |
| 17799 | (w, make_number (MATRIX_ROW_VPOS (last_text_row, desired_matrix))); | ||
| 17800 | eassert (w->window_end_bytepos >= 0); | 17779 | eassert (w->window_end_bytepos >= 0); |
| 17801 | } | 17780 | } |
| 17802 | else if (first_unchanged_at_end_row == NULL | 17781 | else if (first_unchanged_at_end_row == NULL |
| @@ -17806,7 +17785,7 @@ try_window_id (struct window *w) | |||
| 17806 | /* Displayed to end of window, but no line containing text was | 17785 | /* Displayed to end of window, but no line containing text was |
| 17807 | displayed. Lines were deleted at the end of the window. */ | 17786 | displayed. Lines were deleted at the end of the window. */ |
| 17808 | int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0; | 17787 | int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0; |
| 17809 | int vpos = XFASTINT (w->window_end_vpos); | 17788 | int vpos = w->window_end_vpos; |
| 17810 | struct glyph_row *current_row = current_matrix->rows + vpos; | 17789 | struct glyph_row *current_row = current_matrix->rows + vpos; |
| 17811 | struct glyph_row *desired_row = desired_matrix->rows + vpos; | 17790 | struct glyph_row *desired_row = desired_matrix->rows + vpos; |
| 17812 | 17791 | ||
| @@ -17824,8 +17803,8 @@ try_window_id (struct window *w) | |||
| 17824 | } | 17803 | } |
| 17825 | 17804 | ||
| 17826 | eassert (row != NULL); | 17805 | eassert (row != NULL); |
| 17827 | wset_window_end_vpos (w, make_number (vpos + 1)); | 17806 | w->window_end_vpos = vpos + 1; |
| 17828 | wset_window_end_pos (w, make_number (Z - MATRIX_ROW_END_CHARPOS (row))); | 17807 | w->window_end_pos = Z - MATRIX_ROW_END_CHARPOS (row); |
| 17829 | w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); | 17808 | w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); |
| 17830 | eassert (w->window_end_bytepos >= 0); | 17809 | eassert (w->window_end_bytepos >= 0); |
| 17831 | IF_DEBUG (debug_method_add (w, "C")); | 17810 | IF_DEBUG (debug_method_add (w, "C")); |
| @@ -17833,8 +17812,8 @@ try_window_id (struct window *w) | |||
| 17833 | else | 17812 | else |
| 17834 | emacs_abort (); | 17813 | emacs_abort (); |
| 17835 | 17814 | ||
| 17836 | IF_DEBUG (debug_end_pos = XFASTINT (w->window_end_pos); | 17815 | IF_DEBUG (debug_end_pos = w->window_end_pos; |
| 17837 | debug_end_vpos = XFASTINT (w->window_end_vpos)); | 17816 | debug_end_vpos = w->window_end_vpos); |
| 17838 | 17817 | ||
| 17839 | /* Record that display has not been completed. */ | 17818 | /* Record that display has not been completed. */ |
| 17840 | w->window_end_valid = 0; | 17819 | w->window_end_valid = 0; |
| @@ -22002,7 +21981,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 22002 | ptrdiff_t pos = marker_position (w->start); | 21981 | ptrdiff_t pos = marker_position (w->start); |
| 22003 | ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b); | 21982 | ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b); |
| 22004 | 21983 | ||
| 22005 | if (XFASTINT (w->window_end_pos) <= BUF_Z (b) - BUF_ZV (b)) | 21984 | if (w->window_end_pos <= BUF_Z (b) - BUF_ZV (b)) |
| 22006 | { | 21985 | { |
| 22007 | if (pos <= BUF_BEGV (b)) | 21986 | if (pos <= BUF_BEGV (b)) |
| 22008 | return "All"; | 21987 | return "All"; |
| @@ -22031,7 +22010,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 22031 | case 'P': | 22010 | case 'P': |
| 22032 | { | 22011 | { |
| 22033 | ptrdiff_t toppos = marker_position (w->start); | 22012 | ptrdiff_t toppos = marker_position (w->start); |
| 22034 | ptrdiff_t botpos = BUF_Z (b) - XFASTINT (w->window_end_pos); | 22013 | ptrdiff_t botpos = BUF_Z (b) - w->window_end_pos; |
| 22035 | ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b); | 22014 | ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b); |
| 22036 | 22015 | ||
| 22037 | if (botpos >= BUF_ZV (b)) | 22016 | if (botpos >= BUF_ZV (b)) |
| @@ -27040,7 +27019,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 27040 | /* Find the rows corresponding to START_CHARPOS and END_CHARPOS. */ | 27019 | /* Find the rows corresponding to START_CHARPOS and END_CHARPOS. */ |
| 27041 | rows_from_pos_range (w, start_charpos, end_charpos, disp_string, &r1, &r2); | 27020 | rows_from_pos_range (w, start_charpos, end_charpos, disp_string, &r1, &r2); |
| 27042 | if (r1 == NULL) | 27021 | if (r1 == NULL) |
| 27043 | r1 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); | 27022 | r1 = MATRIX_ROW (w->current_matrix, w->window_end_vpos); |
| 27044 | /* If the before-string or display-string contains newlines, | 27023 | /* If the before-string or display-string contains newlines, |
| 27045 | rows_from_pos_range skips to its last row. Move back. */ | 27024 | rows_from_pos_range skips to its last row. Move back. */ |
| 27046 | if (!NILP (before_string) || !NILP (disp_string)) | 27025 | if (!NILP (before_string) || !NILP (disp_string)) |
| @@ -27062,7 +27041,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 27062 | } | 27041 | } |
| 27063 | if (r2 == NULL) | 27042 | if (r2 == NULL) |
| 27064 | { | 27043 | { |
| 27065 | r2 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); | 27044 | r2 = MATRIX_ROW (w->current_matrix, w->window_end_vpos); |
| 27066 | hlinfo->mouse_face_past_end = 1; | 27045 | hlinfo->mouse_face_past_end = 1; |
| 27067 | } | 27046 | } |
| 27068 | else if (!NILP (after_string)) | 27047 | else if (!NILP (after_string)) |
| @@ -27070,7 +27049,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 27070 | /* If the after-string has newlines, advance to its last row. */ | 27049 | /* If the after-string has newlines, advance to its last row. */ |
| 27071 | struct glyph_row *next; | 27050 | struct glyph_row *next; |
| 27072 | struct glyph_row *last | 27051 | struct glyph_row *last |
| 27073 | = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); | 27052 | = MATRIX_ROW (w->current_matrix, w->window_end_vpos); |
| 27074 | 27053 | ||
| 27075 | for (next = r2 + 1; | 27054 | for (next = r2 + 1; |
| 27076 | next <= last | 27055 | next <= last |
| @@ -28376,8 +28355,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 28376 | : Qnil; | 28355 | : Qnil; |
| 28377 | Lisp_Object lim2 = | 28356 | Lisp_Object lim2 = |
| 28378 | NILP (BVAR (XBUFFER (buffer), bidi_display_reordering)) | 28357 | NILP (BVAR (XBUFFER (buffer), bidi_display_reordering)) |
| 28379 | ? make_number (BUF_Z (XBUFFER (buffer)) | 28358 | ? make_number (BUF_Z (XBUFFER (buffer)) - w->window_end_pos) |
| 28380 | - XFASTINT (w->window_end_pos)) | ||
| 28381 | : Qnil; | 28359 | : Qnil; |
| 28382 | 28360 | ||
| 28383 | if (NILP (overlay)) | 28361 | if (NILP (overlay)) |