diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/xdisp.c | 60 |
2 files changed, 22 insertions, 43 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 52fd1db4102..88df9f13762 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2013-08-14 Dmitry Antipov <dmantipov@yandex.ru> | 1 | 2013-08-14 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 2 | ||
| 3 | * xdisp.c (adjust_window_ends): Move duplicated code to new function. | ||
| 4 | (try_window, try_window_reusing_current_matrix, try_window_id): Use it. | ||
| 5 | |||
| 6 | 2013-08-14 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 7 | |||
| 3 | * window.h (struct window): Convert window_end_pos and | 8 | * window.h (struct window): Convert window_end_pos and |
| 4 | window_end_vpos from Lisp_Object to ptrdiff_t and int, respectively. | 9 | window_end_vpos from Lisp_Object to ptrdiff_t and int, respectively. |
| 5 | (wset_window_end_pos, wset_window_end_vpos): Remove. | 10 | (wset_window_end_pos, wset_window_end_vpos): Remove. |
diff --git a/src/xdisp.c b/src/xdisp.c index a1b12b9f60e..b8520e36344 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2461,7 +2461,16 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect) | |||
| 2461 | 2461 | ||
| 2462 | #endif /* HAVE_WINDOW_SYSTEM */ | 2462 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 2463 | 2463 | ||
| 2464 | 2464 | static void | |
| 2465 | adjust_window_ends (struct window *w, struct glyph_row *row, bool current) | ||
| 2466 | { | ||
| 2467 | eassert (w); | ||
| 2468 | w->window_end_pos = Z - MATRIX_ROW_END_CHARPOS (row); | ||
| 2469 | w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); | ||
| 2470 | w->window_end_vpos | ||
| 2471 | = MATRIX_ROW_VPOS (row, current ? w->current_matrix : w->desired_matrix); | ||
| 2472 | } | ||
| 2473 | |||
| 2465 | /*********************************************************************** | 2474 | /*********************************************************************** |
| 2466 | Lisp form evaluation | 2475 | Lisp form evaluation |
| 2467 | ***********************************************************************/ | 2476 | ***********************************************************************/ |
| @@ -16291,9 +16300,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) | |||
| 16291 | if (last_text_row) | 16300 | if (last_text_row) |
| 16292 | { | 16301 | { |
| 16293 | eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row)); | 16302 | eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row)); |
| 16294 | w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); | 16303 | adjust_window_ends (w, last_text_row, 0); |
| 16295 | w->window_end_pos = Z - MATRIX_ROW_END_CHARPOS (last_text_row); | ||
| 16296 | w->window_end_vpos = MATRIX_ROW_VPOS (last_text_row, w->desired_matrix); | ||
| 16297 | eassert | 16304 | eassert |
| 16298 | (MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->desired_matrix, | 16305 | (MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->desired_matrix, |
| 16299 | w->window_end_vpos))); | 16306 | w->window_end_vpos))); |
| @@ -16526,23 +16533,9 @@ try_window_reusing_current_matrix (struct window *w) | |||
| 16526 | The value of last_text_row is the last displayed line | 16533 | The value of last_text_row is the last displayed line |
| 16527 | containing text. */ | 16534 | containing text. */ |
| 16528 | if (last_reused_text_row) | 16535 | if (last_reused_text_row) |
| 16529 | { | 16536 | adjust_window_ends (w, last_reused_text_row, 1); |
| 16530 | w->window_end_bytepos | ||
| 16531 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_reused_text_row); | ||
| 16532 | w->window_end_pos | ||
| 16533 | = Z - MATRIX_ROW_END_CHARPOS (last_reused_text_row); | ||
| 16534 | w->window_end_vpos | ||
| 16535 | = MATRIX_ROW_VPOS (last_reused_text_row, w->current_matrix); | ||
| 16536 | } | ||
| 16537 | else if (last_text_row) | 16537 | else if (last_text_row) |
| 16538 | { | 16538 | adjust_window_ends (w, last_text_row, 0); |
| 16539 | w->window_end_bytepos | ||
| 16540 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); | ||
| 16541 | w->window_end_pos | ||
| 16542 | = Z - MATRIX_ROW_END_CHARPOS (last_text_row); | ||
| 16543 | w->window_end_vpos | ||
| 16544 | = MATRIX_ROW_VPOS (last_text_row, w->desired_matrix); | ||
| 16545 | } | ||
| 16546 | else | 16539 | else |
| 16547 | { | 16540 | { |
| 16548 | /* This window must be completely empty. */ | 16541 | /* This window must be completely empty. */ |
| @@ -16733,14 +16726,7 @@ try_window_reusing_current_matrix (struct window *w) | |||
| 16733 | the window end is in reused rows which in turn means that | 16726 | the window end is in reused rows which in turn means that |
| 16734 | only its vpos can have changed. */ | 16727 | only its vpos can have changed. */ |
| 16735 | if (last_text_row) | 16728 | if (last_text_row) |
| 16736 | { | 16729 | adjust_window_ends (w, last_text_row, 0); |
| 16737 | w->window_end_bytepos | ||
| 16738 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); | ||
| 16739 | w->window_end_pos | ||
| 16740 | = Z - MATRIX_ROW_END_CHARPOS (last_text_row); | ||
| 16741 | w->window_end_vpos | ||
| 16742 | = MATRIX_ROW_VPOS (last_text_row, w->desired_matrix); | ||
| 16743 | } | ||
| 16744 | else | 16730 | else |
| 16745 | w->window_end_vpos -= nrows_scrolled; | 16731 | w->window_end_vpos -= nrows_scrolled; |
| 16746 | 16732 | ||
| @@ -17748,21 +17734,13 @@ try_window_id (struct window *w) | |||
| 17748 | row = find_last_row_displaying_text (w->current_matrix, &it, | 17734 | row = find_last_row_displaying_text (w->current_matrix, &it, |
| 17749 | first_unchanged_at_end_row); | 17735 | first_unchanged_at_end_row); |
| 17750 | eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row)); | 17736 | eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row)); |
| 17751 | 17737 | adjust_window_ends (w, row, 1); | |
| 17752 | w->window_end_pos = Z - MATRIX_ROW_END_CHARPOS (row); | ||
| 17753 | w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); | ||
| 17754 | w->window_end_vpos = MATRIX_ROW_VPOS (row, w->current_matrix); | ||
| 17755 | eassert (w->window_end_bytepos >= 0); | 17738 | eassert (w->window_end_bytepos >= 0); |
| 17756 | IF_DEBUG (debug_method_add (w, "A")); | 17739 | IF_DEBUG (debug_method_add (w, "A")); |
| 17757 | } | 17740 | } |
| 17758 | else if (last_text_row_at_end) | 17741 | else if (last_text_row_at_end) |
| 17759 | { | 17742 | { |
| 17760 | w->window_end_pos | 17743 | adjust_window_ends (w, last_text_row_at_end, 0); |
| 17761 | = Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end); | ||
| 17762 | w->window_end_bytepos | ||
| 17763 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row_at_end); | ||
| 17764 | w->window_end_vpos | ||
| 17765 | = MATRIX_ROW_VPOS (last_text_row_at_end, desired_matrix); | ||
| 17766 | eassert (w->window_end_bytepos >= 0); | 17744 | eassert (w->window_end_bytepos >= 0); |
| 17767 | IF_DEBUG (debug_method_add (w, "B")); | 17745 | IF_DEBUG (debug_method_add (w, "B")); |
| 17768 | } | 17746 | } |
| @@ -17771,11 +17749,7 @@ try_window_id (struct window *w) | |||
| 17771 | /* We have displayed either to the end of the window or at the | 17749 | /* We have displayed either to the end of the window or at the |
| 17772 | end of the window, i.e. the last row with text is to be found | 17750 | end of the window, i.e. the last row with text is to be found |
| 17773 | in the desired matrix. */ | 17751 | in the desired matrix. */ |
| 17774 | w->window_end_pos | 17752 | adjust_window_ends (w, last_text_row, 0); |
| 17775 | = Z - MATRIX_ROW_END_CHARPOS (last_text_row); | ||
| 17776 | w->window_end_bytepos | ||
| 17777 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); | ||
| 17778 | w->window_end_vpos = MATRIX_ROW_VPOS (last_text_row, desired_matrix); | ||
| 17779 | eassert (w->window_end_bytepos >= 0); | 17753 | eassert (w->window_end_bytepos >= 0); |
| 17780 | } | 17754 | } |
| 17781 | else if (first_unchanged_at_end_row == NULL | 17755 | else if (first_unchanged_at_end_row == NULL |