aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/insdel.c67
1 files changed, 17 insertions, 50 deletions
diff --git a/src/insdel.c b/src/insdel.c
index bbf0f7b036e..e73313c3730 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -139,21 +139,7 @@ gap_left (charpos, bytepos, newgap)
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;
@@ -228,19 +214,7 @@ gap_right (charpos, bytepos)
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;
@@ -1737,8 +1711,8 @@ adjust_after_replace (from, from_byte, prev_text, len, len_byte)
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
@@ -1870,10 +1844,10 @@ replace_range (from, to, new, prepare, inherit, markers)
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);
@@ -2019,8 +1993,8 @@ replace_range (from, to, new, prepare, inherit, markers)
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);
@@ -2259,10 +2233,10 @@ del_range_2 (from, from_byte, to, to_byte)
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 {
@@ -2275,8 +2249,8 @@ del_range_2 (from, from_byte, to, to_byte)
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 ();
@@ -2302,14 +2276,7 @@ modify_region (buffer, start, end)
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 ();