diff options
| author | Eli Zaretskii | 2011-07-25 18:36:47 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2011-07-25 18:36:47 +0300 |
| commit | 2238127283d703f38765f9b3f6a64f799d18e9e5 (patch) | |
| tree | 93e26a0639a073f566b6e800a2a133a37b469701 /src | |
| parent | 0f0a88b94cce778a7903196b07a0d70657fb4dc0 (diff) | |
| parent | 7daee9109e1d69d62528f6b460d101e1ea44f4e1 (diff) | |
| download | emacs-2238127283d703f38765f9b3f6a64f799d18e9e5.tar.gz emacs-2238127283d703f38765f9b3f6a64f799d18e9e5.zip | |
Fix logic of caching display string positions for bidi display.
src/xdisp.c (compute_display_string_pos): Fix logic of caching
previous display string position. Initialize cached_prev_pos to -1.
Fixes slow-down at the beginning of a buffer.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/xdisp.c | 12 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e537848ea41..b3d2f64bcc7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2011-07-25 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 | |||
| 1 | 2011-07-24 Eli Zaretskii <eliz@gnu.org> | 7 | 2011-07-24 Eli Zaretskii <eliz@gnu.org> |
| 2 | 8 | ||
| 3 | * xfaces.c (check_lface_attrs) [HAVE_WINDOW_SYSTEM]: Allow `nil' | 9 | * xfaces.c (check_lface_attrs) [HAVE_WINDOW_SYSTEM]: Allow `nil' |
diff --git a/src/xdisp.c b/src/xdisp.c index 8b164008c3f..7493fbff008 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -3137,7 +3137,7 @@ next_overlay_change (EMACS_INT pos) | |||
| 3137 | /* Record one cached display string position found recently by | 3137 | /* Record one cached display string position found recently by |
| 3138 | compute_display_string_pos. */ | 3138 | compute_display_string_pos. */ |
| 3139 | static EMACS_INT cached_disp_pos; | 3139 | static EMACS_INT cached_disp_pos; |
| 3140 | static EMACS_INT cached_prev_pos; | 3140 | static EMACS_INT cached_prev_pos = -1; |
| 3141 | static struct buffer *cached_disp_buffer; | 3141 | static struct buffer *cached_disp_buffer; |
| 3142 | static int cached_disp_modiff; | 3142 | static int cached_disp_modiff; |
| 3143 | static int cached_disp_overlay_modiff; | 3143 | static int cached_disp_overlay_modiff; |
| @@ -3184,18 +3184,22 @@ compute_display_string_pos (struct text_pos *position, | |||
| 3184 | && BUF_MODIFF (b) == cached_disp_modiff | 3184 | && BUF_MODIFF (b) == cached_disp_modiff |
| 3185 | && BUF_OVERLAY_MODIFF (b) == cached_disp_overlay_modiff) | 3185 | && BUF_OVERLAY_MODIFF (b) == cached_disp_overlay_modiff) |
| 3186 | { | 3186 | { |
| 3187 | if (cached_prev_pos | 3187 | if (cached_prev_pos >= 0 |
| 3188 | && cached_prev_pos < charpos && charpos <= cached_disp_pos) | 3188 | && cached_prev_pos < charpos && charpos <= cached_disp_pos) |
| 3189 | return cached_disp_pos; | 3189 | return cached_disp_pos; |
| 3190 | /* Handle overstepping either end of the known interval. */ | 3190 | /* Handle overstepping either end of the known interval. */ |
| 3191 | if (charpos > cached_disp_pos) | 3191 | if (charpos > cached_disp_pos) |
| 3192 | cached_prev_pos = cached_disp_pos; | 3192 | cached_prev_pos = cached_disp_pos; |
| 3193 | else /* charpos <= cached_prev_pos */ | 3193 | else /* charpos <= cached_prev_pos */ |
| 3194 | cached_prev_pos = max (charpos - 1, BEGV); | 3194 | cached_prev_pos = max (charpos - 1, 0); |
| 3195 | } | 3195 | } |
| 3196 | 3196 | ||
| 3197 | /* Record new values in the cache. */ | 3197 | /* Record new values in the cache. */ |
| 3198 | cached_disp_buffer = b; | 3198 | if (b != cached_disp_buffer) |
| 3199 | { | ||
| 3200 | cached_disp_buffer = b; | ||
| 3201 | cached_prev_pos = max (charpos - 1, 0); | ||
| 3202 | } | ||
| 3199 | cached_disp_modiff = BUF_MODIFF (b); | 3203 | cached_disp_modiff = BUF_MODIFF (b); |
| 3200 | cached_disp_overlay_modiff = BUF_OVERLAY_MODIFF (b); | 3204 | cached_disp_overlay_modiff = BUF_OVERLAY_MODIFF (b); |
| 3201 | } | 3205 | } |