comparison src/composite.c @ 81419:ac14f6e0bfff

(update_compositions): Check the validness of compositions.
author Kenichi Handa <handa@m17n.org>
date Thu, 14 Jun 2007 12:33:41 +0000
parents 3d45362f1d38
children 94b0b9678b0f
comparison
equal deleted inserted replaced
81418:5ce347f4e5a9 81419:ac14f6e0bfff
498 deletion will make two compositions adjacent and 498 deletion will make two compositions adjacent and
499 indistinguishable when they have same (eq) property. To 499 indistinguishable when they have same (eq) property. To
500 avoid it, in such a case, we change the property of the 500 avoid it, in such a case, we change the property of the
501 latter to the copy of it. */ 501 latter to the copy of it. */
502 if (from > BEGV 502 if (from > BEGV
503 && find_composition (from - 1, -1, &start, &end, &prop, Qnil)) 503 && find_composition (from - 1, -1, &start, &end, &prop, Qnil)
504 && COMPOSITION_VALID_P (start, end, prop))
504 { 505 {
505 if (from < end) 506 if (from < end)
506 Fput_text_property (make_number (from), make_number (end), 507 Fput_text_property (make_number (from), make_number (end),
507 Qcomposition, 508 Qcomposition,
508 Fcons (XCAR (prop), XCDR (prop)), Qnil); 509 Fcons (XCAR (prop), XCDR (prop)), Qnil);
509 run_composition_function (start, end, prop); 510 run_composition_function (start, end, prop);
510 from = end; 511 from = end;
511 } 512 }
512 else if (from < ZV 513 else if (from < ZV
513 && find_composition (from, -1, &start, &from, &prop, Qnil)) 514 && find_composition (from, -1, &start, &from, &prop, Qnil)
515 && COMPOSITION_VALID_P (start, end, prop))
514 run_composition_function (start, from, prop); 516 run_composition_function (start, from, prop);
515 } 517 }
516 518
517 if (check_mask & CHECK_INSIDE) 519 if (check_mask & CHECK_INSIDE)
518 { 520 {
519 /* In this case, we are sure that (check & CHECK_TAIL) is also 521 /* In this case, we are sure that (check & CHECK_TAIL) is also
520 nonzero. Thus, here we should check only compositions before 522 nonzero. Thus, here we should check only compositions before
521 (to - 1). */ 523 (to - 1). */
522 while (from < to - 1 524 while (from < to - 1
523 && find_composition (from, to, &start, &from, &prop, Qnil) 525 && find_composition (from, to, &start, &from, &prop, Qnil)
526 && COMPOSITION_VALID_P (start, end, prop)
524 && from < to - 1) 527 && from < to - 1)
525 run_composition_function (start, from, prop); 528 run_composition_function (start, from, prop);
526 } 529 }
527 530
528 if (check_mask & CHECK_TAIL) 531 if (check_mask & CHECK_TAIL)
529 { 532 {
530 if (from < to 533 if (from < to
531 && find_composition (to - 1, -1, &start, &end, &prop, Qnil)) 534 && find_composition (to - 1, -1, &start, &end, &prop, Qnil)
535 && COMPOSITION_VALID_P (start, end, prop))
532 { 536 {
533 /* TO should be also at composition boundary. But, 537 /* TO should be also at composition boundary. But,
534 insertion or deletion will make two compositions adjacent 538 insertion or deletion will make two compositions adjacent
535 and indistinguishable when they have same (eq) property. 539 and indistinguishable when they have same (eq) property.
536 To avoid it, in such a case, we change the property of 540 To avoid it, in such a case, we change the property of
540 Qcomposition, 544 Qcomposition,
541 Fcons (XCAR (prop), XCDR (prop)), Qnil); 545 Fcons (XCAR (prop), XCDR (prop)), Qnil);
542 run_composition_function (start, end, prop); 546 run_composition_function (start, end, prop);
543 } 547 }
544 else if (to < ZV 548 else if (to < ZV
545 && find_composition (to, -1, &start, &end, &prop, Qnil)) 549 && find_composition (to, -1, &start, &end, &prop, Qnil)
550 && COMPOSITION_VALID_P (start, end, prop))
546 run_composition_function (start, end, prop); 551 run_composition_function (start, end, prop);
547 } 552 }
548 } 553 }
549 554
550 555