diff options
| author | Kim F. Storm | 2006-02-03 13:14:43 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2006-02-03 13:14:43 +0000 |
| commit | a7684151a85104159274abc39ff9834ac9bc46e3 (patch) | |
| tree | c84a65389647ff7ad1775a8b3abe12f3dadf5582 /src | |
| parent | ad02d7ea94aaa80bf1c69cda460c48752a05cde5 (diff) | |
| download | emacs-a7684151a85104159274abc39ff9834ac9bc46e3.tar.gz emacs-a7684151a85104159274abc39ff9834ac9bc46e3.zip | |
Cache last merged escape glyph face.
(last_escape_glyph_frame, last_escape_glyph_face_id)
(last_escape_glyph_merged_face_id): New variables.
(get_next_display_element): Use/update them.
(redisplay_internal): Reset them before redisplay.
(set_iterator_to_next): Optimize 2004-12-13 fix.
Only recheck faces after displaying ellipsis.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 0a038ea7e63..b25bebe3857 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -5329,6 +5329,10 @@ static int (* get_next_element[NUM_IT_METHODS]) P_ ((struct it *it)) = | |||
| 5329 | display element from the current position of IT. Value is zero if | 5329 | display element from the current position of IT. Value is zero if |
| 5330 | end of buffer (or C string) is reached. */ | 5330 | end of buffer (or C string) is reached. */ |
| 5331 | 5331 | ||
| 5332 | static struct frame *last_escape_glyph_frame = NULL; | ||
| 5333 | static unsigned last_escape_glyph_face_id = (1 << FACE_ID_BITS); | ||
| 5334 | static int last_escape_glyph_merged_face_id = 0; | ||
| 5335 | |||
| 5332 | int | 5336 | int |
| 5333 | get_next_display_element (it) | 5337 | get_next_display_element (it) |
| 5334 | struct it *it; | 5338 | struct it *it; |
| @@ -5445,11 +5449,19 @@ get_next_display_element (it) | |||
| 5445 | face_id = merge_faces (it->f, Qt, lface_id, | 5449 | face_id = merge_faces (it->f, Qt, lface_id, |
| 5446 | it->face_id); | 5450 | it->face_id); |
| 5447 | } | 5451 | } |
| 5452 | else if (it->f == last_escape_glyph_frame | ||
| 5453 | && it->face_id == last_escape_glyph_face_id) | ||
| 5454 | { | ||
| 5455 | face_id = last_escape_glyph_merged_face_id; | ||
| 5456 | } | ||
| 5448 | else | 5457 | else |
| 5449 | { | 5458 | { |
| 5450 | /* Merge the escape-glyph face into the current face. */ | 5459 | /* Merge the escape-glyph face into the current face. */ |
| 5451 | face_id = merge_faces (it->f, Qescape_glyph, 0, | 5460 | face_id = merge_faces (it->f, Qescape_glyph, 0, |
| 5452 | it->face_id); | 5461 | it->face_id); |
| 5462 | last_escape_glyph_frame = it->f; | ||
| 5463 | last_escape_glyph_face_id = it->face_id; | ||
| 5464 | last_escape_glyph_merged_face_id = face_id; | ||
| 5453 | } | 5465 | } |
| 5454 | 5466 | ||
| 5455 | XSETINT (it->ctl_chars[0], g); | 5467 | XSETINT (it->ctl_chars[0], g); |
| @@ -5496,11 +5508,19 @@ get_next_display_element (it) | |||
| 5496 | face_id = merge_faces (it->f, Qt, lface_id, | 5508 | face_id = merge_faces (it->f, Qt, lface_id, |
| 5497 | it->face_id); | 5509 | it->face_id); |
| 5498 | } | 5510 | } |
| 5511 | else if (it->f == last_escape_glyph_frame | ||
| 5512 | && it->face_id == last_escape_glyph_face_id) | ||
| 5513 | { | ||
| 5514 | face_id = last_escape_glyph_merged_face_id; | ||
| 5515 | } | ||
| 5499 | else | 5516 | else |
| 5500 | { | 5517 | { |
| 5501 | /* Merge the escape-glyph face into the current face. */ | 5518 | /* Merge the escape-glyph face into the current face. */ |
| 5502 | face_id = merge_faces (it->f, Qescape_glyph, 0, | 5519 | face_id = merge_faces (it->f, Qescape_glyph, 0, |
| 5503 | it->face_id); | 5520 | it->face_id); |
| 5521 | last_escape_glyph_frame = it->f; | ||
| 5522 | last_escape_glyph_face_id = it->face_id; | ||
| 5523 | last_escape_glyph_merged_face_id = face_id; | ||
| 5504 | } | 5524 | } |
| 5505 | 5525 | ||
| 5506 | /* Handle soft hyphens in the mode where they only get | 5526 | /* Handle soft hyphens in the mode where they only get |
| @@ -5694,6 +5714,8 @@ set_iterator_to_next (it, reseat_p) | |||
| 5694 | 5714 | ||
| 5695 | if (it->dpvec + it->current.dpvec_index == it->dpend) | 5715 | if (it->dpvec + it->current.dpvec_index == it->dpend) |
| 5696 | { | 5716 | { |
| 5717 | int recheck_faces = it->ellipsis_p; | ||
| 5718 | |||
| 5697 | if (it->s) | 5719 | if (it->s) |
| 5698 | it->method = GET_FROM_C_STRING; | 5720 | it->method = GET_FROM_C_STRING; |
| 5699 | else if (STRINGP (it->string)) | 5721 | else if (STRINGP (it->string)) |
| @@ -5716,8 +5738,9 @@ set_iterator_to_next (it, reseat_p) | |||
| 5716 | set_iterator_to_next (it, reseat_p); | 5738 | set_iterator_to_next (it, reseat_p); |
| 5717 | } | 5739 | } |
| 5718 | 5740 | ||
| 5719 | /* Recheck faces after display vector */ | 5741 | /* Maybe recheck faces after display vector */ |
| 5720 | it->stop_charpos = IT_CHARPOS (*it); | 5742 | if (recheck_faces) |
| 5743 | it->stop_charpos = IT_CHARPOS (*it); | ||
| 5721 | } | 5744 | } |
| 5722 | break; | 5745 | break; |
| 5723 | 5746 | ||
| @@ -10545,6 +10568,8 @@ redisplay_internal (preserve_echo_area) | |||
| 10545 | retry: | 10568 | retry: |
| 10546 | pause = 0; | 10569 | pause = 0; |
| 10547 | reconsider_clip_changes (w, current_buffer); | 10570 | reconsider_clip_changes (w, current_buffer); |
| 10571 | last_escape_glyph_frame = NULL; | ||
| 10572 | last_escape_glyph_face_id = (1 << FACE_ID_BITS); | ||
| 10548 | 10573 | ||
| 10549 | /* If new fonts have been loaded that make a glyph matrix adjustment | 10574 | /* If new fonts have been loaded that make a glyph matrix adjustment |
| 10550 | necessary, do it. */ | 10575 | necessary, do it. */ |