Mercurial > emacs
comparison src/xdisp.c @ 62420:de870f134ee0
(handle_display_prop): Handle empty replacement.
(handle_single_display_spec): Return -1 for empty replacement.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Mon, 16 May 2005 21:25:20 +0000 |
parents | d86e84b2256d |
children | 888743d356d9 21eea50897a7 f042e7c0fe20 |
comparison
equal
deleted
inserted
replaced
62419:0853116d727a | 62420:de870f134ee0 |
---|---|
3469 position, display_replaced_p)) | 3469 position, display_replaced_p)) |
3470 display_replaced_p = 1; | 3470 display_replaced_p = 1; |
3471 } | 3471 } |
3472 else | 3472 else |
3473 { | 3473 { |
3474 if (handle_single_display_spec (it, prop, object, position, 0)) | 3474 int ret = handle_single_display_spec (it, prop, object, position, 0); |
3475 if (ret < 0) /* Replaced by "", i.e. nothing. */ | |
3476 return HANDLED_RECOMPUTE_PROPS; | |
3477 if (ret) | |
3475 display_replaced_p = 1; | 3478 display_replaced_p = 1; |
3476 } | 3479 } |
3477 | 3480 |
3478 return display_replaced_p ? HANDLED_RETURN : HANDLED_NORMALLY; | 3481 return display_replaced_p ? HANDLED_RETURN : HANDLED_NORMALLY; |
3479 } | 3482 } |
3513 If PROP is a `space' or `image' specification, and in some other | 3516 If PROP is a `space' or `image' specification, and in some other |
3514 cases too, set *POSITION to the position where the `display' | 3517 cases too, set *POSITION to the position where the `display' |
3515 property ends. | 3518 property ends. |
3516 | 3519 |
3517 Value is non-zero if something was found which replaces the display | 3520 Value is non-zero if something was found which replaces the display |
3518 of buffer or string text. */ | 3521 of buffer or string text. Specifically, the value is -1 if that |
3522 "something" is "nothing". */ | |
3519 | 3523 |
3520 static int | 3524 static int |
3521 handle_single_display_spec (it, spec, object, position, | 3525 handle_single_display_spec (it, spec, object, position, |
3522 display_replaced_before_p) | 3526 display_replaced_before_p) |
3523 struct it *it; | 3527 struct it *it; |
3828 else | 3832 else |
3829 it->area = RIGHT_MARGIN_AREA; | 3833 it->area = RIGHT_MARGIN_AREA; |
3830 | 3834 |
3831 if (STRINGP (value)) | 3835 if (STRINGP (value)) |
3832 { | 3836 { |
3837 if (SCHARS (value) == 0) | |
3838 { | |
3839 pop_it (it); | |
3840 return -1; /* Replaced by "", i.e. nothing. */ | |
3841 } | |
3833 it->string = value; | 3842 it->string = value; |
3834 it->multibyte_p = STRING_MULTIBYTE (it->string); | 3843 it->multibyte_p = STRING_MULTIBYTE (it->string); |
3835 it->current.overlay_string_index = -1; | 3844 it->current.overlay_string_index = -1; |
3836 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; | 3845 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; |
3837 it->end_charpos = it->string_nchars = SCHARS (it->string); | 3846 it->end_charpos = it->string_nchars = SCHARS (it->string); |