diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2006-09-12 16:47:26 +0000 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2006-09-12 16:47:26 +0000 |
commit | 52c0f270f23feccccfca93bab5a353c02581bd5f (patch) | |
tree | 4088e7b986fedd7afd8aeed4bfdd9a7c99543d5e /src/textprop.c | |
parent | 4b1aaa8b07cf2797b5a57e2a1fd88f3ec0aa41e2 (diff) | |
download | emacs-52c0f270f23feccccfca93bab5a353c02581bd5f.tar.gz |
* textprop.c (Fnext_property_change, Fnext_single_property_change)
(Fprevious_property_change, Fprevious_single_property_change):
Avoid changing limit, so we can correctly catch the case where the
property is constant up to limit.
Diffstat (limited to 'src/textprop.c')
-rw-r--r-- | src/textprop.c | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/src/textprop.c b/src/textprop.c index 785ed19b566..a039c17ae64 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -1001,17 +1001,16 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) && (NILP (limit) || next->position < XFASTINT (limit))) next = next_interval (next); - if (NULL_INTERVAL_P (next)) - return limit; - if (NILP (limit)) - XSETFASTINT (limit, (STRINGP (object) - ? SCHARS (object) - : BUF_ZV (XBUFFER (object)))); - if (!(next->position < XFASTINT (limit))) + if (NULL_INTERVAL_P (next) + || (next->position + >= (INTEGERP (limit) + ? XFASTINT (limit) + : (STRINGP (object) + ? SCHARS (object) + : BUF_ZV (XBUFFER (object)))))) return limit; - - XSETFASTINT (position, next->position); - return position; + else + return make_number (next->position); } /* Return 1 if there's a change in some property between BEG and END. */ @@ -1083,16 +1082,16 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) && (NILP (limit) || next->position < XFASTINT (limit))) next = next_interval (next); - if (NULL_INTERVAL_P (next)) - return limit; - if (NILP (limit)) - XSETFASTINT (limit, (STRINGP (object) - ? SCHARS (object) - : BUF_ZV (XBUFFER (object)))); - if (!(next->position < XFASTINT (limit))) + if (NULL_INTERVAL_P (next) + || (next->position + >= (INTEGERP (limit) + ? XFASTINT (limit) + : (STRINGP (object) + ? SCHARS (object) + : BUF_ZV (XBUFFER (object)))))) return limit; - - return make_number (next->position); + else + return make_number (next->position); } DEFUN ("previous-property-change", Fprevious_property_change, @@ -1132,14 +1131,15 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) && (NILP (limit) || (previous->position + LENGTH (previous) > XFASTINT (limit)))) previous = previous_interval (previous); - if (NULL_INTERVAL_P (previous)) - return limit; - if (NILP (limit)) - XSETFASTINT (limit, (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object)))); - if (!(previous->position + LENGTH (previous) > XFASTINT (limit))) - return limit; - return make_number (previous->position + LENGTH (previous)); + if (NULL_INTERVAL_P (previous) + || (previous->position + LENGTH (previous) + <= (INTEGERP (limit) + ? XFASTINT (limit) + : (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object)))))) + return limit; + else + return make_number (previous->position + LENGTH (previous)); } DEFUN ("previous-single-property-change", Fprevious_single_property_change, @@ -1184,14 +1184,15 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) && (NILP (limit) || (previous->position + LENGTH (previous) > XFASTINT (limit)))) previous = previous_interval (previous); - if (NULL_INTERVAL_P (previous)) - return limit; - if (NILP (limit)) - XSETFASTINT (limit, (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object)))); - if (!(previous->position + LENGTH (previous) > XFASTINT (limit))) - return limit; - return make_number (previous->position + LENGTH (previous)); + if (NULL_INTERVAL_P (previous) + || (previous->position + LENGTH (previous) + <= (INTEGERP (limit) + ? XFASTINT (limit) + : (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object)))))) + return limit; + else + return make_number (previous->position + LENGTH (previous)); } /* Callers note, this can GC when OBJECT is a buffer (or nil). */ |