Mercurial > emacs
comparison src/insdel.c @ 20937:f77dcb2556c5
(adjust_before_replace): Comment added.
(adjust_after_replace): Comment added. Give correct args to
adjust_point. Don't call signal_after_change here.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 20 Feb 1998 01:40:47 +0000 |
parents | 454423099620 |
children | 288cf06bf65c |
comparison
equal
deleted
inserted
replaced
20936:5c60cd16452b | 20937:f77dcb2556c5 |
---|---|
1074 from, nchars), | 1074 from, nchars), |
1075 PT - nchars, nchars, | 1075 PT - nchars, nchars, |
1076 current_buffer, inherit); | 1076 current_buffer, inherit); |
1077 } | 1077 } |
1078 | 1078 |
1079 /* This function should be called after moving gap to FROM and before | |
1080 altering LEN chars of text starting from FROM. This adjusts | |
1081 various position keepers and markers and as if the text is deleted. | |
1082 Don't forget to call adjust_after_replace after you actually alter | |
1083 the text. */ | |
1084 | |
1079 void | 1085 void |
1080 adjust_before_replace (from, from_byte, to, to_byte) | 1086 adjust_before_replace (from, from_byte, to, to_byte) |
1081 int from, from_byte, to, to_byte; | 1087 int from, from_byte, to, to_byte; |
1082 { | 1088 { |
1083 adjust_markers_for_delete (from, from_byte, to, to_byte); | 1089 adjust_markers_for_delete (from, from_byte, to, to_byte); |
1084 record_delete (from, to - from); | 1090 record_delete (from, to - from); |
1085 } | 1091 } |
1086 | 1092 |
1093 /* This function should be called after altering the text between FROM | |
1094 and TO to a new text of LEN chars (LEN_BYTE bytes). */ | |
1095 | |
1087 void | 1096 void |
1088 adjust_after_replace (from, from_byte, to, to_byte, len, len_byte) | 1097 adjust_after_replace (from, from_byte, to, to_byte, len, len_byte) |
1089 int from, from_byte, to, to_byte, len, len_byte; | 1098 int from, from_byte, to, to_byte, len, len_byte; |
1090 { | 1099 { |
1091 record_insert (from, len); | 1100 record_insert (from, len); |
1092 if (from < PT) | 1101 if (from < PT) |
1093 adjust_point (len, len_byte); | 1102 adjust_point (len - (to - from), len_byte - (to_byte - from_byte)); |
1094 #ifdef USE_TEXT_PROPERTIES | 1103 #ifdef USE_TEXT_PROPERTIES |
1095 offset_intervals (current_buffer, PT, len - (to - from)); | 1104 offset_intervals (current_buffer, PT, len - (to - from)); |
1096 #endif | 1105 #endif |
1097 adjust_overlays_for_delete (from, to - from); | 1106 adjust_overlays_for_delete (from, to - from); |
1098 adjust_overlays_for_insert (from, len); | 1107 adjust_overlays_for_insert (from, len); |
1099 adjust_markers_for_insert (from, from_byte, | 1108 adjust_markers_for_insert (from, from_byte, |
1100 from + len, from_byte + len_byte, 0); | 1109 from + len, from_byte + len_byte, 0); |
1101 if (len == 0) | 1110 if (len == 0) |
1102 evaporate_overlays (from); | 1111 evaporate_overlays (from); |
1103 MODIFF++; | 1112 MODIFF++; |
1104 signal_after_change (from, to - from, len); | |
1105 } | 1113 } |
1106 | 1114 |
1107 /* Replace the text from character positions FROM to TO with NEW, | 1115 /* Replace the text from character positions FROM to TO with NEW, |
1108 If PREPARE is nonzero, call prepare_to_modify_buffer. | 1116 If PREPARE is nonzero, call prepare_to_modify_buffer. |
1109 If INHERIT, the newly inserted text should inherit text properties | 1117 If INHERIT, the newly inserted text should inherit text properties |