aboutsummaryrefslogtreecommitdiffstats
path: root/src/casefiddle.c
diff options
context:
space:
mode:
authorRichard M. Stallman2004-11-02 09:12:51 +0000
committerRichard M. Stallman2004-11-02 09:12:51 +0000
commit5d19ee8aa5128eaefd9895a79a5f484a29acf487 (patch)
tree30cab6ac832b61f94b49ddf5f28b8cd2cfb9d264 /src/casefiddle.c
parent37663086b1060257daa7f439abe4b58345a66bdc (diff)
downloademacs-5d19ee8aa5128eaefd9895a79a5f484a29acf487.tar.gz
emacs-5d19ee8aa5128eaefd9895a79a5f484a29acf487.zip
(casify_region): Handle changes in byte-length using replace_range_2.
Diffstat (limited to 'src/casefiddle.c')
-rw-r--r--src/casefiddle.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 51fc6444f49..ae4888088bd 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -235,6 +235,10 @@ casify_region (flag, b, e)
235 else if (!UPPERCASEP (c) 235 else if (!UPPERCASEP (c)
236 && (!inword || flag != CASE_CAPITALIZE_UP)) 236 && (!inword || flag != CASE_CAPITALIZE_UP))
237 c = UPCASE1 (c); 237 c = UPCASE1 (c);
238 if (multibyte && c >= 0x80)
239 /* A multibyte result character can't be handled in this
240 simple loop. */
241 break;
238 FETCH_BYTE (i) = c; 242 FETCH_BYTE (i) = c;
239 if (c != c2) 243 if (c != c2)
240 changed = 1; 244 changed = 1;
@@ -272,22 +276,17 @@ casify_region (flag, b, e)
272 tolen = CHAR_STRING (c2, str), 276 tolen = CHAR_STRING (c2, str),
273 fromlen == tolen) 277 fromlen == tolen)
274 { 278 {
279 /* Length is unchanged. */
275 for (j = 0; j < tolen; ++j) 280 for (j = 0; j < tolen; ++j)
276 FETCH_BYTE (i + j) = str[j]; 281 FETCH_BYTE (i + j) = str[j];
277 } 282 }
278 else 283 else
279 { 284 /* Replace one character with the other,
280 error ("Can't casify letters that change length"); 285 keeping text properties the same. */
281#if 0 /* This is approximately what we'd like to be able to do here */ 286 replace_range_2 (start + 1, i + tolen,
282 if (tolen < fromlen) 287 start + 2, i + tolen + fromlen,
283 del_range_1 (i + tolen, i + fromlen, 0, 0); 288 str, 1, tolen,
284 else if (tolen > fromlen) 289 0);
285 {
286 TEMP_SET_PT (i + fromlen);
287 insert_1 (str + fromlen, tolen - fromlen, 1, 0, 0);
288 }
289#endif
290 }
291 } 290 }
292 if ((int) flag >= (int) CASE_CAPITALIZE) 291 if ((int) flag >= (int) CASE_CAPITALIZE)
293 inword = SYNTAX (c2) == Sword; 292 inword = SYNTAX (c2) == Sword;