Mercurial > emacs
comparison src/insdel.c @ 25373:6e6b29a72e2c
(gap_left): Use BUF_COMPUTE_UNCHANGED.
(gap_right): Ditto.
(modify_region): Ditto.
(gap_left): Compute beg/end_unchanged per buffer.
(gap_right): Ditto.
(adjust_after_replace): Likewise.
(replace_range, del_range_2, modify_region): Likewise.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Mon, 23 Aug 1999 00:11:45 +0000 |
parents | c7247eabc834 |
children | d1fbe67c3f69 |
comparison
equal
deleted
inserted
replaced
25372:acf281b41a38 | 25373:6e6b29a72e2c |
---|---|
137 register unsigned char *to, *from; | 137 register unsigned char *to, *from; |
138 register int i; | 138 register int i; |
139 int new_s1; | 139 int new_s1; |
140 | 140 |
141 if (!newgap) | 141 if (!newgap) |
142 { | 142 BUF_COMPUTE_UNCHANGED (current_buffer, charpos, GPT); |
143 if (unchanged_modified == MODIFF | |
144 && overlay_unchanged_modified == OVERLAY_MODIFF) | |
145 { | |
146 beg_unchanged = charpos - BEG; | |
147 end_unchanged = Z - charpos; | |
148 } | |
149 else | |
150 { | |
151 if (Z - GPT < end_unchanged) | |
152 end_unchanged = Z - GPT; | |
153 if (charpos < beg_unchanged) | |
154 beg_unchanged = charpos - BEG; | |
155 } | |
156 } | |
157 | 143 |
158 i = GPT_BYTE; | 144 i = GPT_BYTE; |
159 to = GAP_END_ADDR; | 145 to = GAP_END_ADDR; |
160 from = GPT_ADDR; | 146 from = GPT_ADDR; |
161 new_s1 = GPT_BYTE; | 147 new_s1 = GPT_BYTE; |
226 { | 212 { |
227 register unsigned char *to, *from; | 213 register unsigned char *to, *from; |
228 register int i; | 214 register int i; |
229 int new_s1; | 215 int new_s1; |
230 | 216 |
231 if (unchanged_modified == MODIFF | 217 BUF_COMPUTE_UNCHANGED (current_buffer, charpos, GPT); |
232 && overlay_unchanged_modified == OVERLAY_MODIFF) | |
233 { | |
234 beg_unchanged = charpos - BEG; | |
235 end_unchanged = Z - charpos; | |
236 } | |
237 else | |
238 { | |
239 if (Z - charpos - 1 < end_unchanged) | |
240 end_unchanged = Z - charpos; | |
241 if (GPT - BEG < beg_unchanged) | |
242 beg_unchanged = GPT - BEG; | |
243 } | |
244 | 218 |
245 i = GPT_BYTE; | 219 i = GPT_BYTE; |
246 from = GAP_END_ADDR; | 220 from = GAP_END_ADDR; |
247 to = GPT_ADDR; | 221 to = GPT_ADDR; |
248 new_s1 = GPT_BYTE; | 222 new_s1 = GPT_BYTE; |
1735 if (combined_before_bytes) | 1709 if (combined_before_bytes) |
1736 combine_bytes (from, from_byte, combined_before_bytes); | 1710 combine_bytes (from, from_byte, combined_before_bytes); |
1737 } | 1711 } |
1738 | 1712 |
1739 /* As byte combining will decrease Z, we must check this again. */ | 1713 /* As byte combining will decrease Z, we must check this again. */ |
1740 if (Z - GPT < end_unchanged) | 1714 if (Z - GPT < END_UNCHANGED) |
1741 end_unchanged = Z - GPT; | 1715 END_UNCHANGED = Z - GPT; |
1742 | 1716 |
1743 CHECK_MARKERS (); | 1717 CHECK_MARKERS (); |
1744 | 1718 |
1745 if (len == 0) | 1719 if (len == 0) |
1746 evaporate_overlays (from); | 1720 evaporate_overlays (from); |
1868 *(GPT_ADDR) = 0; /* Put an anchor. */ | 1842 *(GPT_ADDR) = 0; /* Put an anchor. */ |
1869 | 1843 |
1870 if (GPT_BYTE < GPT) | 1844 if (GPT_BYTE < GPT) |
1871 abort (); | 1845 abort (); |
1872 | 1846 |
1873 if (GPT - BEG < beg_unchanged) | 1847 if (GPT - BEG < BEG_UNCHANGED) |
1874 beg_unchanged = GPT - BEG; | 1848 BEG_UNCHANGED = GPT - BEG; |
1875 if (Z - GPT < end_unchanged) | 1849 if (Z - GPT < END_UNCHANGED) |
1876 end_unchanged = Z - GPT; | 1850 END_UNCHANGED = Z - GPT; |
1877 | 1851 |
1878 if (GAP_SIZE < insbytes) | 1852 if (GAP_SIZE < insbytes) |
1879 make_gap (insbytes - GAP_SIZE); | 1853 make_gap (insbytes - GAP_SIZE); |
1880 | 1854 |
1881 /* Copy the string text into the buffer, perhaps converting | 1855 /* Copy the string text into the buffer, perhaps converting |
2017 } | 1991 } |
2018 if (combined_before_bytes) | 1992 if (combined_before_bytes) |
2019 combine_bytes (from, from_byte, combined_before_bytes); | 1993 combine_bytes (from, from_byte, combined_before_bytes); |
2020 | 1994 |
2021 /* As byte combining will decrease Z, we must check this again. */ | 1995 /* As byte combining will decrease Z, we must check this again. */ |
2022 if (Z - GPT < end_unchanged) | 1996 if (Z - GPT < END_UNCHANGED) |
2023 end_unchanged = Z - GPT; | 1997 END_UNCHANGED = Z - GPT; |
2024 | 1998 |
2025 if (outgoing_insbytes == 0) | 1999 if (outgoing_insbytes == 0) |
2026 evaporate_overlays (from); | 2000 evaporate_overlays (from); |
2027 | 2001 |
2028 CHECK_MARKERS (); | 2002 CHECK_MARKERS (); |
2257 *(GPT_ADDR) = 0; /* Put an anchor. */ | 2231 *(GPT_ADDR) = 0; /* Put an anchor. */ |
2258 | 2232 |
2259 if (GPT_BYTE < GPT) | 2233 if (GPT_BYTE < GPT) |
2260 abort (); | 2234 abort (); |
2261 | 2235 |
2262 if (GPT - BEG < beg_unchanged) | 2236 if (GPT - BEG < BEG_UNCHANGED) |
2263 beg_unchanged = GPT - BEG; | 2237 BEG_UNCHANGED = GPT - BEG; |
2264 if (Z - GPT < end_unchanged) | 2238 if (Z - GPT < END_UNCHANGED) |
2265 end_unchanged = Z - GPT; | 2239 END_UNCHANGED = Z - GPT; |
2266 | 2240 |
2267 if (combined_after_bytes) | 2241 if (combined_after_bytes) |
2268 { | 2242 { |
2269 /* Adjust markers for byte combining. As we have already | 2243 /* Adjust markers for byte combining. As we have already |
2270 adjuted markers without concerning byte combining, here we | 2244 adjuted markers without concerning byte combining, here we |
2273 0, combined_after_bytes); | 2247 0, combined_after_bytes); |
2274 combine_bytes (from, from_byte, combined_after_bytes); | 2248 combine_bytes (from, from_byte, combined_after_bytes); |
2275 | 2249 |
2276 record_insert (GPT - 1, 1); | 2250 record_insert (GPT - 1, 1); |
2277 | 2251 |
2278 if (Z - GPT < end_unchanged) | 2252 if (Z - GPT < END_UNCHANGED) |
2279 end_unchanged = Z - GPT; | 2253 END_UNCHANGED = Z - GPT; |
2280 } | 2254 } |
2281 | 2255 |
2282 CHECK_MARKERS (); | 2256 CHECK_MARKERS (); |
2283 | 2257 |
2284 evaporate_overlays (from); | 2258 evaporate_overlays (from); |
2300 if (buffer != old_buffer) | 2274 if (buffer != old_buffer) |
2301 set_buffer_internal (buffer); | 2275 set_buffer_internal (buffer); |
2302 | 2276 |
2303 prepare_to_modify_buffer (start, end, NULL); | 2277 prepare_to_modify_buffer (start, end, NULL); |
2304 | 2278 |
2305 if (start - 1 < beg_unchanged | 2279 BUF_COMPUTE_UNCHANGED (buffer, start - 1, end); |
2306 || (unchanged_modified == MODIFF | |
2307 && overlay_unchanged_modified == OVERLAY_MODIFF)) | |
2308 beg_unchanged = start - 1; | |
2309 if (Z - end < end_unchanged | |
2310 || (unchanged_modified == MODIFF | |
2311 && overlay_unchanged_modified == OVERLAY_MODIFF)) | |
2312 end_unchanged = Z - end; | |
2313 | 2280 |
2314 if (MODIFF <= SAVE_MODIFF) | 2281 if (MODIFF <= SAVE_MODIFF) |
2315 record_first_change (); | 2282 record_first_change (); |
2316 MODIFF++; | 2283 MODIFF++; |
2317 | 2284 |