Mercurial > emacs
comparison src/textprop.c @ 42967:51ac72369873
(Fnext_property_change, Fnext_single_property_change)
(Fprevious_property_change, Fprevious_single_property_change):
Stay within the narrowed-buffer boundaries.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 25 Jan 2002 22:42:05 +0000 |
parents | 67d2bb283076 |
children | fccc867cca64 |
comparison
equal
deleted
inserted
replaced
42966:afd482080b6f | 42967:51ac72369873 |
---|---|
881 register INTERVAL i, next; | 881 register INTERVAL i, next; |
882 | 882 |
883 if (NILP (object)) | 883 if (NILP (object)) |
884 XSETBUFFER (object, current_buffer); | 884 XSETBUFFER (object, current_buffer); |
885 | 885 |
886 if (! NILP (limit) && ! EQ (limit, Qt)) | 886 if (!NILP (limit) && !EQ (limit, Qt)) |
887 CHECK_NUMBER_COERCE_MARKER (limit); | 887 CHECK_NUMBER_COERCE_MARKER (limit); |
888 | 888 |
889 i = validate_interval_range (object, &position, &position, soft); | 889 i = validate_interval_range (object, &position, &position, soft); |
890 | 890 |
891 /* If LIMIT is t, return start of next interval--don't | 891 /* If LIMIT is t, return start of next interval--don't |
909 if (NULL_INTERVAL_P (i)) | 909 if (NULL_INTERVAL_P (i)) |
910 return limit; | 910 return limit; |
911 | 911 |
912 next = next_interval (i); | 912 next = next_interval (i); |
913 | 913 |
914 while (! NULL_INTERVAL_P (next) && intervals_equal (i, next) | 914 while (!NULL_INTERVAL_P (next) && intervals_equal (i, next) |
915 && (NILP (limit) || next->position < XFASTINT (limit))) | 915 && (NILP (limit) || next->position < XFASTINT (limit))) |
916 next = next_interval (next); | 916 next = next_interval (next); |
917 | 917 |
918 if (NULL_INTERVAL_P (next)) | 918 if (NULL_INTERVAL_P (next)) |
919 return limit; | 919 return limit; |
920 if (! NILP (limit) && !(next->position < XFASTINT (limit))) | 920 if (NILP (limit)) |
921 XSETFASTINT (limit, (STRINGP (object) | |
922 ? XSTRING (object)->size | |
923 : BUF_ZV (XBUFFER (object)))); | |
924 if (!(next->position < XFASTINT (limit))) | |
921 return limit; | 925 return limit; |
922 | 926 |
923 XSETFASTINT (position, next->position); | 927 XSETFASTINT (position, next->position); |
924 return position; | 928 return position; |
925 } | 929 } |
991 && (NILP (limit) || next->position < XFASTINT (limit))) | 995 && (NILP (limit) || next->position < XFASTINT (limit))) |
992 next = next_interval (next); | 996 next = next_interval (next); |
993 | 997 |
994 if (NULL_INTERVAL_P (next)) | 998 if (NULL_INTERVAL_P (next)) |
995 return limit; | 999 return limit; |
996 if (! NILP (limit) && !(next->position < XFASTINT (limit))) | 1000 if (NILP (limit)) |
1001 XSETFASTINT (limit, (STRINGP (object) | |
1002 ? XSTRING (object)->size | |
1003 : BUF_ZV (XBUFFER (object)))); | |
1004 if (!(next->position < XFASTINT (limit))) | |
997 return limit; | 1005 return limit; |
998 | 1006 |
999 return make_number (next->position); | 1007 return make_number (next->position); |
1000 } | 1008 } |
1001 | 1009 |
1028 /* Start with the interval containing the char before point. */ | 1036 /* Start with the interval containing the char before point. */ |
1029 if (i->position == XFASTINT (position)) | 1037 if (i->position == XFASTINT (position)) |
1030 i = previous_interval (i); | 1038 i = previous_interval (i); |
1031 | 1039 |
1032 previous = previous_interval (i); | 1040 previous = previous_interval (i); |
1033 while (! NULL_INTERVAL_P (previous) && intervals_equal (previous, i) | 1041 while (!NULL_INTERVAL_P (previous) && intervals_equal (previous, i) |
1034 && (NILP (limit) | 1042 && (NILP (limit) |
1035 || (previous->position + LENGTH (previous) > XFASTINT (limit)))) | 1043 || (previous->position + LENGTH (previous) > XFASTINT (limit)))) |
1036 previous = previous_interval (previous); | 1044 previous = previous_interval (previous); |
1037 if (NULL_INTERVAL_P (previous)) | 1045 if (NULL_INTERVAL_P (previous)) |
1038 return limit; | 1046 return limit; |
1039 if (!NILP (limit) | 1047 if (NILP (limit)) |
1040 && !(previous->position + LENGTH (previous) > XFASTINT (limit))) | 1048 XSETFASTINT (limit, (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object)))); |
1049 if (!(previous->position + LENGTH (previous) > XFASTINT (limit))) | |
1041 return limit; | 1050 return limit; |
1042 | 1051 |
1043 return make_number (previous->position + LENGTH (previous)); | 1052 return make_number (previous->position + LENGTH (previous)); |
1044 } | 1053 } |
1045 | 1054 |
1068 CHECK_NUMBER_COERCE_MARKER (limit); | 1077 CHECK_NUMBER_COERCE_MARKER (limit); |
1069 | 1078 |
1070 i = validate_interval_range (object, &position, &position, soft); | 1079 i = validate_interval_range (object, &position, &position, soft); |
1071 | 1080 |
1072 /* Start with the interval containing the char before point. */ | 1081 /* Start with the interval containing the char before point. */ |
1073 if (! NULL_INTERVAL_P (i) && i->position == XFASTINT (position)) | 1082 if (!NULL_INTERVAL_P (i) && i->position == XFASTINT (position)) |
1074 i = previous_interval (i); | 1083 i = previous_interval (i); |
1075 | 1084 |
1076 if (NULL_INTERVAL_P (i)) | 1085 if (NULL_INTERVAL_P (i)) |
1077 return limit; | 1086 return limit; |
1078 | 1087 |
1079 here_val = textget (i->plist, prop); | 1088 here_val = textget (i->plist, prop); |
1080 previous = previous_interval (i); | 1089 previous = previous_interval (i); |
1081 while (! NULL_INTERVAL_P (previous) | 1090 while (!NULL_INTERVAL_P (previous) |
1082 && EQ (here_val, textget (previous->plist, prop)) | 1091 && EQ (here_val, textget (previous->plist, prop)) |
1083 && (NILP (limit) | 1092 && (NILP (limit) |
1084 || (previous->position + LENGTH (previous) > XFASTINT (limit)))) | 1093 || (previous->position + LENGTH (previous) > XFASTINT (limit)))) |
1085 previous = previous_interval (previous); | 1094 previous = previous_interval (previous); |
1086 if (NULL_INTERVAL_P (previous)) | 1095 if (NULL_INTERVAL_P (previous)) |
1087 return limit; | 1096 return limit; |
1088 if (!NILP (limit) | 1097 if (NILP (limit)) |
1089 && !(previous->position + LENGTH (previous) > XFASTINT (limit))) | 1098 XSETFASTINT (limit, (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object)))); |
1099 if (!(previous->position + LENGTH (previous) > XFASTINT (limit))) | |
1090 return limit; | 1100 return limit; |
1091 | 1101 |
1092 return make_number (previous->position + LENGTH (previous)); | 1102 return make_number (previous->position + LENGTH (previous)); |
1093 } | 1103 } |
1094 | 1104 |