aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/xdisp.c12
2 files changed, 14 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index dd5a1fba871..8aa1237f693 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12011-07-24 Eli Zaretskii <eliz@gnu.org>
2
3 * xdisp.c (compute_display_string_pos): Fix logic of caching
4 previous display string position. Initialize cached_prev_pos to
5 -1. Fixes slow-down at the beginning of a buffer.
6
12011-07-23 Eli Zaretskii <eliz@gnu.org> 72011-07-23 Eli Zaretskii <eliz@gnu.org>
2 8
3 * xdisp.c (move_it_in_display_line_to): Record the best matching 9 * xdisp.c (move_it_in_display_line_to): Record the best matching
diff --git a/src/xdisp.c b/src/xdisp.c
index a5eb2aa923a..5f9e80cd11e 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3140,7 +3140,7 @@ next_overlay_change (EMACS_INT pos)
3140/* Record one cached display string position found recently by 3140/* Record one cached display string position found recently by
3141 compute_display_string_pos. */ 3141 compute_display_string_pos. */
3142static EMACS_INT cached_disp_pos; 3142static EMACS_INT cached_disp_pos;
3143static EMACS_INT cached_prev_pos; 3143static EMACS_INT cached_prev_pos = -1;
3144static struct buffer *cached_disp_buffer; 3144static struct buffer *cached_disp_buffer;
3145static int cached_disp_modiff; 3145static int cached_disp_modiff;
3146static int cached_disp_overlay_modiff; 3146static int cached_disp_overlay_modiff;
@@ -3190,18 +3190,22 @@ compute_display_string_pos (struct text_pos *position,
3190 && BUF_MODIFF (b) == cached_disp_modiff 3190 && BUF_MODIFF (b) == cached_disp_modiff
3191 && BUF_OVERLAY_MODIFF (b) == cached_disp_overlay_modiff) 3191 && BUF_OVERLAY_MODIFF (b) == cached_disp_overlay_modiff)
3192 { 3192 {
3193 if (cached_prev_pos 3193 if (cached_prev_pos >= 0
3194 && cached_prev_pos < charpos && charpos <= cached_disp_pos) 3194 && cached_prev_pos < charpos && charpos <= cached_disp_pos)
3195 return cached_disp_pos; 3195 return cached_disp_pos;
3196 /* Handle overstepping either end of the known interval. */ 3196 /* Handle overstepping either end of the known interval. */
3197 if (charpos > cached_disp_pos) 3197 if (charpos > cached_disp_pos)
3198 cached_prev_pos = cached_disp_pos; 3198 cached_prev_pos = cached_disp_pos;
3199 else /* charpos <= cached_prev_pos */ 3199 else /* charpos <= cached_prev_pos */
3200 cached_prev_pos = max (charpos - 1, BEGV); 3200 cached_prev_pos = max (charpos - 1, 0);
3201 } 3201 }
3202 3202
3203 /* Record new values in the cache. */ 3203 /* Record new values in the cache. */
3204 cached_disp_buffer = b; 3204 if (b != cached_disp_buffer)
3205 {
3206 cached_disp_buffer = b;
3207 cached_prev_pos = max (charpos - 1, 0);
3208 }
3205 cached_disp_modiff = BUF_MODIFF (b); 3209 cached_disp_modiff = BUF_MODIFF (b);
3206 cached_disp_overlay_modiff = BUF_OVERLAY_MODIFF (b); 3210 cached_disp_overlay_modiff = BUF_OVERLAY_MODIFF (b);
3207 } 3211 }