diff options
| author | Eli Zaretskii | 2014-06-14 12:44:20 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-06-14 12:44:20 +0300 |
| commit | 78275cd0ed1816e67f0fb331b4ebca4aac5d1cc7 (patch) | |
| tree | e2eef62cea6bd5ea1d650ed9286d55281d6f1eba | |
| parent | 340ced7ecbfbc40a5db23eedc25581eb462465df (diff) | |
| download | emacs-78275cd0ed1816e67f0fb331b4ebca4aac5d1cc7.tar.gz emacs-78275cd0ed1816e67f0fb331b4ebca4aac5d1cc7.zip | |
src/xdisp.c: Enhance commentary.
| -rw-r--r-- | src/xdisp.c | 67 |
1 files changed, 64 insertions, 3 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index f0eeb9ac601..adcd281334f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -98,7 +98,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 98 | 98 | ||
| 99 | This function attempts to redisplay a window by reusing parts of | 99 | This function attempts to redisplay a window by reusing parts of |
| 100 | its existing display. It finds and reuses the part that was not | 100 | its existing display. It finds and reuses the part that was not |
| 101 | changed, and redraws the rest. | 101 | changed, and redraws the rest. (The "id" part in the function's |
| 102 | name stands for "insert/delete", not for "identification" or | ||
| 103 | somesuch.) | ||
| 102 | 104 | ||
| 103 | . try_window | 105 | . try_window |
| 104 | 106 | ||
| @@ -113,6 +115,19 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 113 | optimizations were successful, redisplay calls redisplay_windows, | 115 | optimizations were successful, redisplay calls redisplay_windows, |
| 114 | which performs a full redisplay of all windows. | 116 | which performs a full redisplay of all windows. |
| 115 | 117 | ||
| 118 | Note that there's one more important optimization up Emacs's | ||
| 119 | sleeve, but it is related to actually redrawing the potentially | ||
| 120 | changed portions of the window/frame, not to reproducing the | ||
| 121 | desired matrices of those potentially changed portions. Namely, | ||
| 122 | the function update_frame and its subroutines, which you will find | ||
| 123 | in dispnew.c, compare the desired matrices with the current | ||
| 124 | matrices, and only redraw the portions that changed. So it could | ||
| 125 | happen that the functions in this file for some reason decide that | ||
| 126 | the entire desired matrix needs to be regenerated from scratch, and | ||
| 127 | still only parts of the Emacs display, or even nothing at all, will | ||
| 128 | be actually delivered to the glass, because update_frame has found | ||
| 129 | that the new and the old screen contents are similar or identical. | ||
| 130 | |||
| 116 | Desired matrices. | 131 | Desired matrices. |
| 117 | 132 | ||
| 118 | Desired matrices are always built per Emacs window. The function | 133 | Desired matrices are always built per Emacs window. The function |
| @@ -15757,7 +15772,51 @@ set_vertical_scroll_bar (struct window *w) | |||
| 15757 | selected_window is redisplayed. | 15772 | selected_window is redisplayed. |
| 15758 | 15773 | ||
| 15759 | We can return without actually redisplaying the window if fonts has been | 15774 | We can return without actually redisplaying the window if fonts has been |
| 15760 | changed on window's frame. In that case, redisplay_internal will retry. */ | 15775 | changed on window's frame. In that case, redisplay_internal will retry. |
| 15776 | |||
| 15777 | As one of the important parts of redisplaying a window, we need to | ||
| 15778 | decide whether the previous window-start position (stored in the | ||
| 15779 | window's w->start marker position) is still valid, and if it isn't, | ||
| 15780 | recompute it. Some details about that: | ||
| 15781 | |||
| 15782 | . The previous window-start could be in a continuation line, in | ||
| 15783 | which case we need to recompute it when the window width | ||
| 15784 | changes. See compute_window_start_on_continuation_line and its | ||
| 15785 | call below. | ||
| 15786 | |||
| 15787 | . The text that changed since last redisplay could include the | ||
| 15788 | previous window-start position. In that case, we try to salvage | ||
| 15789 | what we can from the current glyph matrix by calling | ||
| 15790 | try_scrolling, which see. | ||
| 15791 | |||
| 15792 | . Some Emacs command could force us to use a specific window-start | ||
| 15793 | position by setting the window's force_start flag, or gently | ||
| 15794 | propose doing that by setting the window's optional_new_start | ||
| 15795 | flag. In these cases, we try using the specified start point if | ||
| 15796 | that succeeds (i.e. the window desired matrix is successfully | ||
| 15797 | recomputed, and point location is within the window). In case | ||
| 15798 | of optional_new_start, we first check if the specified start | ||
| 15799 | position is feasible, i.e. if it will allow point to be | ||
| 15800 | displayed in the window. If using the specified start point | ||
| 15801 | fails, e.g., if new fonts are needed to be loaded, we abort the | ||
| 15802 | redisplay cycle and leave it up to the next cycle to figure out | ||
| 15803 | things. | ||
| 15804 | |||
| 15805 | . Note that the window's force_start flag is sometimes set by | ||
| 15806 | redisplay itself, when it decides that the previous window start | ||
| 15807 | point is fine and should be kept. Search for "goto force_start" | ||
| 15808 | below to see the details. Like the values of window-start | ||
| 15809 | specified outside of redisply, these internally deduced values | ||
| 15810 | are tested for feasibility, and ignored if found to be | ||
| 15811 | unfeasible. | ||
| 15812 | |||
| 15813 | . Note that the function try_window, used to completely redisplay | ||
| 15814 | a window, accepts the window's start point as its argument. | ||
| 15815 | This is used several times in the redisplay code to control | ||
| 15816 | where the window start will be, according to user options such | ||
| 15817 | as scroll-conservatively, and also to ensure the screen line | ||
| 15818 | showing point will be fully (as opposed to partially) visible on | ||
| 15819 | display. */ | ||
| 15761 | 15820 | ||
| 15762 | static void | 15821 | static void |
| 15763 | redisplay_window (Lisp_Object window, bool just_this_one_p) | 15822 | redisplay_window (Lisp_Object window, bool just_this_one_p) |
| @@ -15803,6 +15862,8 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) | |||
| 15803 | eassert (XMARKER (w->start)->buffer == buffer); | 15862 | eassert (XMARKER (w->start)->buffer == buffer); |
| 15804 | eassert (XMARKER (w->pointm)->buffer == buffer); | 15863 | eassert (XMARKER (w->pointm)->buffer == buffer); |
| 15805 | 15864 | ||
| 15865 | /* We come here again if we need to run window-text-change-functions | ||
| 15866 | below. */ | ||
| 15806 | restart: | 15867 | restart: |
| 15807 | reconsider_clip_changes (w); | 15868 | reconsider_clip_changes (w); |
| 15808 | frame_line_height = default_line_pixel_height (w); | 15869 | frame_line_height = default_line_pixel_height (w); |
| @@ -15867,7 +15928,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) | |||
| 15867 | && !current_buffer->prevent_redisplay_optimizations_p | 15928 | && !current_buffer->prevent_redisplay_optimizations_p |
| 15868 | && !window_outdated (w)); | 15929 | && !window_outdated (w)); |
| 15869 | 15930 | ||
| 15870 | /* Run the window-bottom-change-functions | 15931 | /* Run the window-text-change-functions |
| 15871 | if it is possible that the text on the screen has changed | 15932 | if it is possible that the text on the screen has changed |
| 15872 | (either due to modification of the text, or any other reason). */ | 15933 | (either due to modification of the text, or any other reason). */ |
| 15873 | if (!current_matrix_up_to_date_p | 15934 | if (!current_matrix_up_to_date_p |