diff options
| author | Chong Yidong | 2007-05-19 18:43:14 +0000 |
|---|---|---|
| committer | Chong Yidong | 2007-05-19 18:43:14 +0000 |
| commit | 41d25268172048b91c4af05bc80b392838ef6036 (patch) | |
| tree | 74b390f311f687145cc7447c1ca3518b40256756 /src | |
| parent | f176569090e06e716faf0be193215277713ff5a0 (diff) | |
| download | emacs-41d25268172048b91c4af05bc80b392838ef6036.tar.gz emacs-41d25268172048b91c4af05bc80b392838ef6036.zip | |
(redisplay_window): If first window line is a continuation line,
recompute the new window start instead of recentering.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 50 |
1 files changed, 14 insertions, 36 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 82f24551f19..151d9980116 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -12777,7 +12777,7 @@ redisplay_window (window, just_this_one_p) | |||
| 12777 | int rc; | 12777 | int rc; |
| 12778 | int centering_position = -1; | 12778 | int centering_position = -1; |
| 12779 | int last_line_misfit = 0; | 12779 | int last_line_misfit = 0; |
| 12780 | int save_beg_unchanged, save_end_unchanged; | 12780 | int beg_unchanged, end_unchanged; |
| 12781 | 12781 | ||
| 12782 | SET_TEXT_POS (lpoint, PT, PT_BYTE); | 12782 | SET_TEXT_POS (lpoint, PT, PT_BYTE); |
| 12783 | opoint = lpoint; | 12783 | opoint = lpoint; |
| @@ -12842,8 +12842,8 @@ redisplay_window (window, just_this_one_p) | |||
| 12842 | set_buffer_internal_1 (XBUFFER (w->buffer)); | 12842 | set_buffer_internal_1 (XBUFFER (w->buffer)); |
| 12843 | SET_TEXT_POS (opoint, PT, PT_BYTE); | 12843 | SET_TEXT_POS (opoint, PT, PT_BYTE); |
| 12844 | 12844 | ||
| 12845 | save_beg_unchanged = BEG_UNCHANGED; | 12845 | beg_unchanged = BEG_UNCHANGED; |
| 12846 | save_end_unchanged = END_UNCHANGED; | 12846 | end_unchanged = END_UNCHANGED; |
| 12847 | 12847 | ||
| 12848 | current_matrix_up_to_date_p | 12848 | current_matrix_up_to_date_p |
| 12849 | = (!NILP (w->window_end_valid) | 12849 | = (!NILP (w->window_end_valid) |
| @@ -12968,6 +12968,8 @@ redisplay_window (window, just_this_one_p) | |||
| 12968 | w->force_start = Qt; | 12968 | w->force_start = Qt; |
| 12969 | } | 12969 | } |
| 12970 | 12970 | ||
| 12971 | force_start: | ||
| 12972 | |||
| 12971 | /* Handle case where place to start displaying has been specified, | 12973 | /* Handle case where place to start displaying has been specified, |
| 12972 | unless the specified location is outside the accessible range. */ | 12974 | unless the specified location is outside the accessible range. */ |
| 12973 | if (!NILP (w->force_start) | 12975 | if (!NILP (w->force_start) |
| @@ -13147,40 +13149,16 @@ redisplay_window (window, just_this_one_p) | |||
| 13147 | than a simple mouse-click. */ | 13149 | than a simple mouse-click. */ |
| 13148 | if (NILP (w->start_at_line_beg) | 13150 | if (NILP (w->start_at_line_beg) |
| 13149 | && NILP (do_mouse_tracking) | 13151 | && NILP (do_mouse_tracking) |
| 13150 | && CHARPOS (startp) > BEGV) | 13152 | && CHARPOS (startp) > BEGV |
| 13153 | && CHARPOS (startp) > BEG + beg_unchanged | ||
| 13154 | && CHARPOS (startp) <= Z - end_unchanged) | ||
| 13151 | { | 13155 | { |
| 13152 | #if 0 | 13156 | w->force_start = Qt; |
| 13153 | /* The following code tried to make BEG_UNCHANGED and | 13157 | if (XMARKER (w->start)->buffer == current_buffer) |
| 13154 | END_UNCHANGED up to date (similar to try_window_id). | 13158 | compute_window_start_on_continuation_line (w); |
| 13155 | Is it important to do so? | 13159 | SET_TEXT_POS_FROM_MARKER (startp, w->start); |
| 13156 | 13160 | goto force_start; | |
| 13157 | The trouble is that it's a little too strict when it | 13161 | } |
| 13158 | comes to overlays: modify_overlay can call | ||
| 13159 | BUF_COMPUTE_UNCHANGED, which alters BUF_BEG_UNCHANGED and | ||
| 13160 | BUF_END_UNCHANGED directly without moving the gap. | ||
| 13161 | |||
| 13162 | This can result in spurious recentering when overlays are | ||
| 13163 | altered in the buffer. So unless it's proven necessary, | ||
| 13164 | let's leave this commented out for now. -- cyd. */ | ||
| 13165 | if (MODIFF > SAVE_MODIFF | ||
| 13166 | || BEG_UNCHANGED + END_UNCHANGED > Z_BYTE) | ||
| 13167 | { | ||
| 13168 | if (GPT - BEG < BEG_UNCHANGED) | ||
| 13169 | BEG_UNCHANGED = GPT - BEG; | ||
| 13170 | if (Z - GPT < END_UNCHANGED) | ||
| 13171 | END_UNCHANGED = Z - GPT; | ||
| 13172 | } | ||
| 13173 | #endif | ||
| 13174 | |||
| 13175 | if (CHARPOS (startp) > BEG + save_beg_unchanged | ||
| 13176 | && CHARPOS (startp) <= Z - save_end_unchanged) | ||
| 13177 | { | ||
| 13178 | /* There doesn't seems to be a simple way to find a new | ||
| 13179 | window start that is near the old window start, so | ||
| 13180 | we just recenter. */ | ||
| 13181 | goto recenter; | ||
| 13182 | } | ||
| 13183 | } | ||
| 13184 | 13162 | ||
| 13185 | #if GLYPH_DEBUG | 13163 | #if GLYPH_DEBUG |
| 13186 | debug_method_add (w, "same window start"); | 13164 | debug_method_add (w, "same window start"); |